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
1
vote
0 answers

make a request with request.js in another request

i am creating an inline telegram bot but i have problem my problem is i have a request in another request that i want the inner request's results into outer one and my code is : request(urlToSearch, function (error, response, body) { var $ =…
Melfun
  • 353
  • 1
  • 3
  • 14
1
vote
0 answers

request for pdf file recieved with wrong encoding

i'm trying to download pdf files from an api using the requst js module. i've set up a test route on express that fetches the file and send it back to the user. let url = 'http://www.workagreements.economy.gov.il/Agreements/' + String(agrNum) +…
Roip
  • 81
  • 2
  • 6
1
vote
2 answers

Node.js and Request.js: Finding the file extension for a download?

I'm trying to download a couple of files using request, but I don't know how to find what their extensions are. Some of them are images, some are sounds, some are videos, but all of them come from a URL with no extension at the end. const request =…
MysteryPancake
  • 1,365
  • 1
  • 18
  • 47
1
vote
1 answer

Wait HTTP response to resolve function

I'm using express.js to create a proxy server to handle calls from a website, manipulate the request, then make a request for a third party provider. I need to wait for the third party response in order response to my website, but can't find a way…
1
vote
1 answer

Prevent express body-parser from removing body prior to request.pipe

I am trying to create a simple express middleware filter which should look at the POST body and determine if it should be piped to the correct server, or blocked. If I use body-parser it appears that I do get the req.body available to me, but it…
Automatico
  • 12,420
  • 9
  • 82
  • 110
1
vote
1 answer

How to post a data with an array field in react request?

So I'm using request from https://github.com/request/request#forms. In tsx file, I'm passing id: id, text: string, array: number[]. post( {json: true, url: '...', form: {id: id, text: text, array: array}}, (error, response, body) => { …
Eugenia Kim
  • 143
  • 2
  • 10
1
vote
1 answer

NodeJS, function call not returning undefined even after done

Hello: i am new to nodejs and mocha. I am struggling with the return value from a function call. It is always returning 'undefined' even though (i think) i have used the callback done() appropriately. In the following example, how can i ensure that…
Bipo K
  • 395
  • 3
  • 20
1
vote
2 answers

how to create ip alias in nodejs

I am writing test in nodejs. Calling my api using requestjs. Now I have to make one call using an ip address to the api (/resources/media) Then I have to make another call to the same api (/resources/media) using different ip from the same…
Know Nothing
  • 1,121
  • 2
  • 10
  • 21
1
vote
0 answers

request proxy and relative links

In my expressJS setup, I am having it use the Request module to load an external url and pipe it to the response. Example: app.all('/otherApp', function (req, res) { request.get({ url:'http://myotherapp.mysite.com' …
mls3590712
  • 750
  • 1
  • 6
  • 20
1
vote
2 answers

Callback on recursive function

The following code is used to fetch a .zip file from our web application. The file is generated by closing another application safely then zipping, finally sending it for download. var dl = function() { request({ method: 'GET', …
stackunderflow
  • 1,644
  • 6
  • 24
  • 40
1
vote
0 answers

piping with requestjs in node 0.10 vs higher version

so I need some help understanding what exactly happens when piping requests and if there is a difference between node 0.10.x and 4.5.x I have something like this: function(req, res, next){ if(req.method === 'PUT'){ var putOptions = { …
Gustav
  • 3,408
  • 4
  • 24
  • 41
1
vote
4 answers

After NodeJS script has an error, it will not start again. AWS Lambda

I have a lambda function on the nodejs4.x runtime. If my script stops execution due to an error, lets say I try to get .length of an undefined object, then I can't start the script again. It's not even like the script runs and hits the same error,…
1
vote
1 answer

OpenShift: Multiple post requests from nodejs being fired

I am trying out the OpenShift cloud server with a nodejs instance. I am trying to perform a POST request to the oneSignal API. The POST is successful but oneSignal sends 4 notifications for a single POST. I think I have isolated that the issue is…
hussainb
  • 1,218
  • 2
  • 15
  • 33
1
vote
0 answers

Exactly duplicating a multipart form upload

So I'm trying to upload a file using the request/request package. The file is 40589387 bytes in size and a .dmg file. When I upload the file using the package or anything else other than a straight HTML form it adds a few bytes to the file. So here…
Rodrigo
  • 3,129
  • 3
  • 33
  • 61
1
vote
0 answers

Downloading a zip file using AngularJS

I'm having trouble downloading a zip file in an AngularJS application. The setup is an AngularJS app with a fairly lightweight node backend using Hapi. What I'm trying to do is click a button in Angular to make a call to the Angular Apps backend,…
Mike Caputo
  • 1,156
  • 17
  • 33