How to use the unirest.post function in unirest

To help you get started, we’ve selected a few unirest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pantsel / konga / api / services / KongPluginService.js View on Github external
addDynamicSSLPlugin: function (fds, req, res) {
    return unirest.post(req.connection.kong_admin_url + req.url.replace('/kong', ''))
      .headers({'Content-Type': 'multipart/form-data'})
      .field('name', req.body.name)
      .field('config.only_https', req.body['config.only_https'] || false)
      .field('config.accept_http_if_already_terminated', req.body['config.accept_http_if_already_terminated'] || false)
      .attach('config.cert', fds[0])
      .attach('config.key', fds[1])
      .end(function (response) {
        if (response.error) return res.kongError(response)
        return res.json(response.body)
      });
  },
github pantsel / konga / api / services / KongService.js View on Github external
create: function (req, res) {

    unirest.post(Utils.withoutTrailingSlash(req.connection.kong_admin_url) + req.url.replace('/kong', ''))
      .headers(KongService.headers(req, true))
      .send(req.body)
      .end(function (response) {
        if (response.error) return res.kongError(response);
        return res.json(response.body);
      });
  },
github nikhiljha / nem-api / src / index.js View on Github external
post(path, data, callback) {
        unirest.post(this.endpoint + path)
    .headers({"Accept":"application/json", "Content-Type":"application/json"})
    .send(data)
    .end(callback);
    }
github Tangerine-Community / Tangerine / client / scripts / preload.js View on Github external
function post(opts) {
  var data = opts.data || {};
  return unirest.post(opts.url)
    .header('Accept', 'application/json')
    .header('Content-Type', 'application/json')
    .send(data);
}

unirest

Simplified, lightweight HTTP client library

MIT
Latest version published 5 years ago

Package Health Score

47 / 100
Full package analysis

Popular unirest functions