Tabnine Logo For Javascript
Response.headers
Code IndexAdd Tabnine to your IDE (free)

How to use
headers
function
in
Response

Best JavaScript code snippets using request.Response.headers(Showing top 15 results out of 594)

origin: sx1989827/DOClever

func.then(function (result) {
    var res={}
    res.header=result.headers;
    res.status=String(result.statusCode);
    res.second=(((new Date())-startDate)/1000).toFixed(3);
origin: eashish93/imgsquash

})
res.set({
  'cache-control': resp.headers['cache-control'],
  'content-type': resp.headers['content-type'],
  'content-length': resp.headers['content-length'],
  'content-disposition': `attachment; filename=${parseName(ext, name)}`,
  'etag': resp.headers['etag']
});
resp.pipe(res);
origin: paschmann/rasa-ui

 return;
} else {
 model.server_file_name = response.headers["filename"];
 model.response = response;
 logger.winston.info("Training Completed, Rasa Server Response Code : " + response.statusCode);
  server_response: response.headers["filename"],
  training_data: JSON.stringify(req.body)
 });
origin: WilsonHo/node_examples

request.post(parm, (error, res, body) => {
 if(error){

 }else{
  console.log(res.statusCode);
  console.log(res.headers);
  fs.writeFile('bcdf.html', res.body)
 }
});
origin: StirFry-js/stirfry

//Write header
  it('can write headers', function(done) {
    const server = new StirFry(8080);

    server.req(function(req, res) {
      res.setHeader('content-type', 'text/html');
    });
    request('http://localhost:8080', function(error, response) {
      server.close();
      if (error) done(error);
      response.headers['content-type'].should.equal('text/html');
      done();
    });
  });
origin: chrisben/image-thumb

var downloadFile = function (url, callback) {
  return request({url: url, encoding: null}, function(error, response, imageBuffer) {
    if (options.cacheEnabled) {
      writeToCache(url, imageBuffer, response.headers);
    }
    return callback(error, response.headers, imageBuffer);
  });
}
origin: Autodesk-Forge/bim360appstore-data.management-nodejs-transfer.storage

request(source)
    .on('response', function (resSource) {
     if (process.env.CONSOLELOG)
      console.log('Download ' + source.url + ': ' + resSource.statusCode + ' > ' + resSource.statusMessage);

     sourceStatusCode = resSource.statusCode;
     resSource.headers['content-type'] = undefined; // if the source response have this header, Dropbox may file for some types
    })
    .pipe(request(destination)
     .on('response', function (resDestination) {
      if (process.env.CONSOLELOG)
       console.log('Upload ' + destination.url + ': ' + resDestination.statusCode + ' > ' + resDestination.statusMessage);

      MakeCallback(autodeskId, taskId, resDestination.statusCode, sourceStatusCode, data, callback);
     }));
origin: MT-Libraries/MT-Notes

request.get(remoteUrl)
      .on('response', function (response) {
        console.log('#ON:', response.statusCode, response.headers['content-type']);
      })
      .on('err', function (err) {
        console.log('#ERR ', err);
      })
      .pipe(writeStream)
      .on('end', function () {
        return result;
      });
origin: hiproxy/hiproxy

function reqAndCheck (done, url, checkHeaders) {
 request({
  uri: url
 }, function (err, response, body) {
  if (err) {
   return done(err);
  }

  var headers = response.headers;

  for (var key in checkHeaders) {
   assert.equal(headers[key], checkHeaders[key]);
  }

  assert.notEqual(body.length, 0);

  done();
 });
}
origin: matteocontrini/node-bypasser

request(options, function(error, response, body) {
    if (error || response.statusCode != 302) {
      callback('Unexpected response status code. Response code: ' + response.statusCode);
      return;
    }
    
    callback(null, response.headers.location);
  });
origin: MT-Libraries/MT-Notes

request.get(encodeURI(_url))
        .on('response', function(response) {
          console.log(response.statusCode,response.headers['content-type']);
        })
        .on('error',function(err){
          res.json({
            code: 500,
            data: JSON.parse(err)
          });
        })
        .on('end',function(){
          console.log('request end');
        })
        .pipe(res);
origin: WilsonHo/node_examples

request.post(param, (e, r, b)=> {
 console.log(r.headers);
 console.log(b);
 fs.writeFile('abc.html', b);
})
origin: steveperry-53/examples-nodejs

request('https://www.googleapis.com/discovery/v1/apis',

 function (error, response, body) {
  if (!error && response.statusCode == 200) {
   console.log(request.headers);
   console.log(response.headers)
  }
 }
)
origin: matteocontrini/node-bypasser

request(options, function(error, response, body) {
    if (error || [301, 302].indexOf(response.statusCode) == -1) {
      callback('URL not recognized as supported');
      return;
    }
    
    callback(null, response.headers.location);
  });
origin: Autodesk-Forge/bim360appstore-data.management-nodejs-transfer.storage

request(source)
    .on('response', function (resSource) {
     if (process.env.CONSOLELOG)
      console.log('Download ' + source.url + ': ' + resSource.statusCode + ' > ' + resSource.statusMessage);

     sourceStatusCode = resSource.statusCode;
     resSource.headers['content-type'] = undefined; // if the source response have this header, Dropbox may file for some types
    })
    .pipe(request(destination)
     .on('response', function (resDestination) {
      if (process.env.CONSOLELOG)
       console.log('Upload ' + destination.url + ': ' + resDestination.statusCode + ' > ' + resDestination.statusMessage);

      MakeCallback(autodeskId, taskId, resDestination.statusCode, sourceStatusCode, data, callback);
     }));
request(npm)Responseheaders

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

4 Minute Read

How to Use Asynchronous Functions in JavaScript

Popular in JavaScript

  • yargs
    yargs the modern, pirate-themed, successor to optimist.
  • cheerio
    Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • readable-stream
    Streams3, a user-land copy of the stream library from Node.js
  • ws
    Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js
  • through2
    A tiny wrapper around Node.js streams.Transform (Streams2/3) to avoid explicit subclassing noise
  • postcss
  • fs
  • semver
    The semantic version parser used by npm.
  • fs-extra
    fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.
  • From CI to AI: The AI layer in your organization
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