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
1 answer

How to make json-rpc request with Adonis

Am using Adonis to build a Bitcoin RPC system, so am making request with request.js Lib, so but the issue is with the callback when I make the request it works but I can't see send the response to the web endpoint, when I console the response from…
user3424387
  • 21
  • 2
  • 8
0
votes
0 answers

Node.JS HTTP request using proxy leaks original IP address

I'm trying to make GET requests to a public webserver (eg. https://*.com) through a proxy to hide my real IP address. The GET request returns a JSON Object which contains the IP Address the request originally was made from. I'm currently using…
0
votes
1 answer

Security Implication on req.pipe nodejs

I am building a basic cors proxy, And in one of the use cases I need to pipe request, so I thought of using pipe with Request.js as shown in below image I am not so expert in security. Could someone list possible security Implications from the…
Sandeep Patel
  • 4,815
  • 3
  • 21
  • 37
0
votes
1 answer

How can i get an error on specific response code natively?

Now this method throws an error if the response code is not 2xx (learned experimentally) const request = require('request-promise-native'); (async () => { try { const response = await request({ uri: 'http://httpbin.org/status/201', …
0
votes
0 answers

NodeJs request response body is empty

Don't understand why the response body of the following request is empty: request: req.headers['User-Agent'] = 'request'; req.headers['Accept'] = 'text/html'; const options = { url: config.prodURL, headers: req.headers, qs: req.query, …
Esteban Rincon
  • 2,040
  • 3
  • 27
  • 44
0
votes
2 answers

Corrupted file using request js

I am using request js to download a file. function requ(){ const options = { uri: `api/tasks/${id}/attachments/${attachmentId}` } return rp.get(options) } My question is: why piping to "res" like requ().pipe(res) works and…
0
votes
2 answers

HTTP POST with node.js and request library isn't outputting anything

I'm just testing to see if my POST request to a website works, but it isn't outputting anything. When I use RunKit, it shows an output, but not in my powershell. Am I doing something wrong or is there no output? How can I make it show the output?…
0
votes
0 answers

Reading big .txt and checking if string contains on response body

I have this code: var fs = require('fs'); var readline = require('readline'); var request = require("request"); var filename = process.argv[2]; readline.createInterface({ input: fs.createReadStream(filename), terminal: false }).on('line',…
0
votes
0 answers

Node.js Parallel Post Requests

I have a large .txt file that contains user id's of my website. Example: 10929 10299 01021 39100 23841 The txt file has more than 10k id's. Would it be possible to read all of the .txt content and send 100 requests (each request a different id)…
0
votes
1 answer

Node.js REQUEST throwing ECONNREFUSED after a few attempts

I am using the below code: async function validateMOData(data, callback) { success('Validation started'); let a = 0; let i = data.length; console.log('length of array', i); while (i--) { a = a + 1; …
writeToBhuwan
  • 3,233
  • 11
  • 39
  • 67
0
votes
1 answer

How to get multiple bodyResponses to ejs

I'm using a forEach loop to make a request to two different paths, but, although it does console.log() both bodyResponses, it gives error when trying to save it to render "index.ejs" with its value. (index.ejs is the template I wanna…
Pedro
  • 1
  • 3
0
votes
0 answers

Is it possible to use request js and cheerio js to build chrome extension

I want to build a web scraper plugin, I have used cheerio js and request js and have built a scraper that runs well in cmd line, but when I use the same code and run as chrome extension, its not working, so I would like to know if there is any way…
0
votes
2 answers

Use a request body with requestjs

I am using requestjs to send a request to https://www.handelsregister.de/rp_web/search.do. The request should look like this: How can I add a request body? My attempt: function callback(error, response, body) { if (error) return error; //…
Neskews
  • 764
  • 1
  • 10
  • 23
0
votes
0 answers

Node NPM Request how to send a post request

I have been googling for this and only found this. let req = request({ url: "http://localhost/api/v1/phone", method: 'POST', json: { param1: "abc", param2: "def" } }, function…
TrongBang
  • 923
  • 1
  • 12
  • 23
0
votes
0 answers

request.js Bearer authentication not working

Have a problem with request/request library. Bearer authentication does not seem to work. Expected behavior: Want to send an http request to heroku to get information about my dyno What happens: 404 despite sending proper authentication I have tried…
Petr Gazarov
  • 3,602
  • 2
  • 20
  • 37