Questions tagged [requestjs]

Request - Simplified HTTP client

Request is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default.

var request = require('request');
request('http://www.google.com', function (error, response, body) {
  if (!error && response.statusCode == 200) {
    console.log(body) // Show the HTML for the Google homepage.
  }
})

Available Options

  • Streaming
  • Forms
  • HTTP Authentication
  • Custom HTTP Headers
  • OAuth Signing
  • Proxies
  • Unix Domain Sockets
  • TLS/SSL Protocol
  • Support for HAR 1.2

Request in GitHub

Request in npm


Deprecated Warning!

As of Feb 11th 2020, request is fully deprecated. No new changes are expected to land. In fact, none have landed for some time.

For more information about why request is deprecated and possible alternatives refer to this issue.

143 questions
0
votes
0 answers

How to reduce execution time of parsing urls with request module in node js?

I'm a beginner with js and nodejs. I'm writing a simple program, which loads and parses array of urls with help of request and cheerio modules. It takes me really long time to parse array, which contains about 700 urls, about 40 seconds. So, I'm…
K.Rice
  • 599
  • 1
  • 8
  • 27
0
votes
2 answers

nodejs express - cant set headers

using the values submitted by a webfrom served by express to initiate crawl using request + cheerio. the parts work separately, when put together i get an error: Can't set headers after they are sent. what's wrong here? router.post('/',…
0
votes
1 answer

TypeError: callback is not a function when executing a callback

I'm trying to run a callback when the end event is fired by a stream in coffee-script. On attempting to run my code, I receive the following error: C:\Users\Gum-Joe\Documents\Projects\retisci\lib\downloader.js:45 callback(); ^ TypeError:…
Gum Joe
  • 45
  • 1
  • 9
0
votes
0 answers

Unable to use self signed certificate with node-ssl-root-cas

I am trying to use self signed certificate of badssl.com through requestjs. I used node-ssl-root-cas to inject certificates Here is the code & I am getting error all the time. var request = require('request'); var fs = require('fs'); var path =…
Arpit
  • 190
  • 1
  • 4
  • 15
0
votes
1 answer

Using multiple proxies via request.js

I am trying to send a list of proxy addresses to requestjs & want it to use first one that's is working. Is it at all possible via request.js My code is var body = ''; request.post({ url: www.google.com, …
Arpit
  • 190
  • 1
  • 4
  • 15
0
votes
1 answer

node js: request js multipart 2nd level file and JSON.stringify

I'm trying to turn this CURL call into request.js curl -i -X POST "https://api.soundcloud.com/tracks.json" \ -F 'oauth_token=***' \ -F 'track[asset_data]=@music.wav' \ -F 'track[title]=Track title' \ …
Robby
  • 315
  • 2
  • 11
0
votes
1 answer

node.js and hapi: fetching data from a database synchronously

Coming from a .net world where synchronicity is a given I can query my data from a back end source such as a database, lucene, or even another API, I'm having a trouble finding a good sample of this for node.js where async is the norm. The issue I'm…
Kaylee
  • 145
  • 1
  • 10
0
votes
1 answer

Using requireJS to load 'lib/request' inside html code

I'm trying to create a webpage that will make requests into a neo4j database. I do the request from a javascript file /projectFolder/js/query.js: function submitQuery() { var r = require("request"); var txUrl =…
Lucas Azevedo
  • 1,867
  • 22
  • 39
0
votes
1 answer

nodeJS file upload using request library

I am trying to upload a file to a server (built using Java) by reading from a mongodb gridfs stream. exports.upload = function(req, res, next) { var IHUrl = config.api.url + "PhotosServlet"; var data = req.body; var file1 =…
Prabhat
  • 4,066
  • 4
  • 34
  • 41
0
votes
2 answers

Trying to use request with ES6 + Webpack, but I am getting an error

I am currently trying to create a webapp with React, and I am trying to make a request to my server (with request). However, whenever I try to webpack the app I get an error. I am almost certain it has to do with request having to be labeled as an…
HerrPfister
  • 67
  • 1
  • 2
  • 7
0
votes
1 answer

how to send a pdf base64 variable through a nodejs request?

Trying to send a base64 pdf string with request, but I can't seem to figure out the proper structure of the request. Thanks in advance for the help! var dpdf = pdfvar.toString('base64'); var options = { method: 'POST', body: dpdf, …
user3527354
  • 586
  • 1
  • 7
  • 20
0
votes
1 answer

using request.get file body is not correct

I'm trying to upload a file to s3 using request.js but the file data seems to be incorrect after I upload it. Should I be using a data property of the response object instead? var flickrPhotoUrl =…
MonkeyBonkey
  • 46,433
  • 78
  • 254
  • 460
0
votes
1 answer

Edit redirect uri Request.js after login

I'm using request.js and cheerio.js to scrape a password protected website. Is it possible to edit the response uri such that I could scrape another page other than the one I'm being redirected to?
Kreutzer
  • 328
  • 4
  • 12
0
votes
1 answer

ensureErrorObject in then() (bluebird promises)

I'm trying to develop a function with bluebird and request. In the module I have: module.prototype.getUsers = function (opts) { return new Promise(function(reject, resolve){ request .post({ url: opts.uri, …
wOvalle
  • 87
  • 9
0
votes
1 answer

Piping from request.js to s3.upload results in a zero byte file

I'm trying to pipe a file from request.js straight to s3. The code below is the closest I've managed to figure out. It runs, but the file that ends up on s3 is zero bytes. What am I getting wrong? var request = require('request'); var AWS =…
Josh Santangelo
  • 918
  • 3
  • 11
  • 22
1 2 3
9
10