Codota Logo For Javascript
httpRequest
Code IndexAdd Codota to your IDE (free)

How to use
httpRequest
function
in
request

Best JavaScript code snippets using request.httpRequest(Showing top 9 results out of 315)

origin: dobestan/nodejs-101

router.get("/", function(request, response) {
 var query = request.query.query;

 var watchaApiUrl = "https://watcha.net/home/news.json?page=1&per=20";
 httpRequest(watchaApiUrl, function(error, httpResponse, body) {
  var data = JSON.parse(body);
  var newsItems = data.news;

  if (query) {
   var matchedNewsItems = [];

   newsItems.forEach(function(newsItem) {
    if (newsItem.title.indexOf(query) > -1) {
     matchedNewsItems.push(newsItem);
    }
   });

   newsItems = matchedNewsItems;
  }

  return response.render("watcha", {newsItems: newsItems, query: query});
 });
});
origin: simonprickett/bartfbchatbot

function sendGenericMessage(sender, messageData) {
  httpRequest({
    url: 'https://graph.facebook.com/v2.6/me/messages',
    qs: { 
      access_token: FACEBOOK_PAGE_ACCESS_TOKEN 
    },
    method: 'POST',
    json: {
      recipient: {
        id: sender
      },
      message: messageData,
    }
  }, function(error, response, body) {
    if (error) {
      console.log('Error sending message: ', error);
    } else if (response.body.error) {
      console.log('Error: ', response.body.error);
    }
  });
}
origin: infinispan/js-client

function invokeDmrHttp(op, port) {
 return new Promise(function(fulfil, reject) {
  httpRequest({
   method: 'POST',
   url: 'http://localhost:' + port + '/rest/v2',
   auth: {
    user: 'admin',
    pass: 'mypassword',
    sendImmediately: false
   },
   headers: {
    'Content-Type' : 'application/json'
   },
   body: JSON.stringify(op)
  }, function(error, response, body) {
   if (!error && response.statusCode == 200) {
    fulfil(JSON.parse(body));
   } else {
    reject(util.format('Error (%s), body (%s), response(%s)',
     error, body, JSON.stringify(response)));
   }
  });
 });
}
origin: simonprickett/bartfbchatbot

function processLocation(sender, coords) {
  httpRequest({
    url: BART_API_BASE + '/station/' + coords.lat + '/' + coords.long,
    method: 'GET'
origin: infinispan/js-client

function invokeDmrHttpGet(opUrl, port) {
  return new Promise(function(fulfil, reject) {
    httpRequest({
      method: 'GET',
      url: 'http://localhost:' + port + '/rest/v2' + opUrl,
      auth: {
        user: 'admin',
        pass: 'mypassword',
        sendImmediately: false
      },
      headers: {
        'Content-Type' : 'application/json'
      }
    }, function(error, response, body) {
      if (!error && response.statusCode == 200) {
       var resp = "";
       if (body) {
        resp = JSON.parse(body);
       }
       fulfil(resp);
      } else {
        reject(util.format('Error (%s), body (%s), response(%s)',
          error, body, JSON.stringify(response)));
      }
    });
  });
}
origin: dobestan/nodejs-101

httpRequest(url, function(error, httpResponse, body) {
 var data = JSON.parse(body);
 var newsItems = data.news;
origin: dan-divy/spruce

httpRequest(options, function(error, response, body) {
httpRequest(
 "https://www.googleapis.com/oauth2/v3/userinfo?access_token=" +
  tokens.access_token,
origin: simonprickett/bartfbchatbot

  sendTextMessage(sender, respText.substring(26));
} else if (reqText.indexOf('stations') > -1) {
  httpRequest({
    url: BART_API_BASE + '/stations',
    method: 'GET'
    stationCode = stationCode.trim();
    httpRequest({
      url: BART_API_BASE + '/departures/' + stationCode,
      method: 'GET'
  httpRequest({
    url: BART_API_BASE + '/elevatorStatus',
    method: 'GET'
  }); 
} else if (reqText.indexOf('status') > -1) {
  httpRequest({
    url: BART_API_BASE + '/status',
    method: 'GET'
      status = JSON.parse(body);
      httpRequest({
        url: BART_API_BASE + '/serviceAnnouncements',
        method: 'GET'
origin: simonprickett/bartfbchatbot

function sendTextMessage(sender, text) {
  var messageData = {
    text: text
  };

  httpRequest({
    url: 'https://graph.facebook.com/v2.6/me/messages',
    qs: { 
      access_token: FACEBOOK_PAGE_ACCESS_TOKEN 
    },
    method: 'POST',
    json: {
      recipient: { 
        id: sender
      },
      message: messageData,
    }
  }, function(error, response, body) {
    if (error) {
      console.log('Error sending message: ', error);
    } else if (response.body.error) {
      console.log('Error: ', response.body.error);
    }
  });
}
request(npm)httpRequest

Most used request functions

  • request
  • Response.statusCode
  • RequestAPI.post
  • RequestAPI.get
  • Request.pipe
  • rp,
  • Request.on,
  • Response.headers,
  • RequestAPI.defaults,
  • RequestAPI.put,
  • RequestAPI.jar,
  • Response.statusMessage,
  • RequestAPI.head,
  • Response.on,
  • RequestAPI.cookie,
  • RequestAPI.delete,
  • Response.pipe,
  • RequestAPI.del,
  • requestRetry

Popular in JavaScript

  • moment
    Parse, validate, manipulate, and display dates
  • mocha
    simple, flexible, fun test framework
  • qs
    A querystring parser that supports nesting and arrays, with a depth limit
  • js-yaml
    YAML 1.2 parser and serializer
  • chalk
    Terminal string styling done right
  • readable-stream
    Streams3, a user-land copy of the stream library from Node.js
  • mkdirp
    Recursively mkdir, like `mkdir -p`
  • webpack
    Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.
  • winston
    A logger for just about everything.
  • Top plugins for WebStorm
    The challenge is finding the best plugins for JavaScript development on Intellij IDEs. Who wants to sit there and go over hundreds of plugins to pick the best?
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJavascript Code Index
Get Codota for your IDE now