Tabnine Logo For Javascript
baseRequest
Code IndexAdd Tabnine to your IDE (free)

How to use
baseRequest
function
in
request

Best JavaScript code snippets using request.baseRequest(Showing top 2 results out of 315)

origin: troy-lamerton/image-golf

function callAPI (answer, renderResponse, callback) {
 var imgUrlArr = []
 var baseRequest = request.defaults({
  headers: {'Api-Key': process.env.GETTY_KEY,
       'Client-Secret': process.env.GETTY_SECRET}
 })
 var picAPI = 'https://api.gettyimages.com/v3/search/images?fields=id,title,thumb,referral_destinations&sort_order=best&phrase=' + answer

 baseRequest(picAPI, function(err, res, body) {
  // Maybe write something in case it doesn't return 5
  if (!err && res.statusCode == 200) {
   var imgObj = JSON.parse(body)
  }
  for(var i = 0; i < 5; i++) {
   imgUrlArr.push(imgObj.images[i].display_sizes[0].uri)
  }
  renderResponse.imagesArray = imgUrlArr
  callback(null, renderResponse)
 })
}
origin: bucko13/bcoin-boilerplate

});
baseRequest(options, (err, resp, body) => {
 if (err) {
  return res.status(400).send({ error: err });
request(npm)baseRequest

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

  • async
    Higher-order functions and common patterns for asynchronous code
  • debug
    small debugging utility
  • moment
    Parse, validate, manipulate, and display dates
  • through2
    A tiny wrapper around Node.js streams.Transform (Streams2/3) to avoid explicit subclassing noise
  • http
  • q
    A library for promises (CommonJS/Promises/A,B,D)
  • ws
    Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js
  • 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.
  • readable-stream
    Streams3, a user-land copy of the stream library from Node.js
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now