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
3
votes
3 answers

TypeError: data.filter is not a function

I am trying to filter an array of JSON objects, which I get from an API call on my proxy. I am using a Node.js web framework Express to make the API call. API returns the following: { data: [ { type: "aaa", name: "Cycle", …
PineCone
  • 2,193
  • 12
  • 37
  • 78
3
votes
1 answer

how to force execution of requests inside async.each with nodejs?

I have a async.each that iterates an array and for every element inside the array it execute a function "check" that has a request inside. This is the code but when I run it I see from the debugger that node doesn't execute the check function and it…
3
votes
1 answer

NodeJS REST turkish character, Socket hang up

My REST service is the following: const express = require('express'), app = express(); ... app.get('/turkish-escape/:id', function(req, res) { console.log("converting turkish special characters:"); console.log("\u011f…
nufuk
  • 41
  • 5
3
votes
1 answer

node.js requestjs fails vs curl

We are trying to call a JSON based API using requestjs, but we're getting an error from the server. request.get({ url: 'https://api.myapi.com', timeout: 120000, headers: { username: 'myuser', …
Guy Korland
  • 9,139
  • 14
  • 59
  • 106
2
votes
0 answers

Module name "request" has not been loaded yet for context: _. Use require([])

I'm trying to load a function that returns a JSON to me on an HTML page in order to create a table. Is is there a way to be able to launch that function and the JSON body of return insert it in a variable present in the HTML to be able to transform…
2
votes
1 answer

Always get 502 error when calling AWS lambda endpoint from Node Js using `requestjs`

trying to post data in our AWS serverless api using Nodejs Request package but always get 502 error and can post data from the front end app (React or Jquery). var dataToPost = { name: 'ABC', address: 'XYZ' } request( { method: 'POST' ,…
Sandeep Soni
  • 85
  • 1
  • 7
2
votes
1 answer

8192 limited data size in NodeJS request

I'm trying to fetch json from an api but only half of the response is received. So how to get the full response? var request = require('request'); var url_to_check = 'http://example.com/api/test'; request.get(url_to_check).on('data', function(data)…
Alice
  • 55
  • 3
2
votes
0 answers

What does "error code 13" mean in the Node package Request?

I'm using a node server that uses Request to hit a different server. The servers are in the same internal environment and have no connection restrictions, such as firewall or auth. However, whenever I try send a POST request from one to another, I…
Daniel Fullerton
  • 153
  • 1
  • 11
2
votes
3 answers

How to add server-side delay to Javascript for loop?

I'm fiddling around with using Node.js to scrape data from an e-commerce site. I use Request to retrieve the DOM of the page and Cheerio to do server-side DOM selection. const cheerio = require('cheerio'); const request = require('request'); //…
fuzzybabybunny
  • 5,146
  • 6
  • 32
  • 58
2
votes
5 answers

Process 50k webpages on runtime (NodeJS)

I need to download ~50k webpages, get some data from them and put it to variable. I wrap each request into Promise and then Promise.all() them. I use Request library. Simplified code: const request = require('request'); const urls = [url1, url2,…
Ted Romanus
  • 582
  • 2
  • 10
  • 27
2
votes
1 answer

request.js fails where CURL succeeds for GET request with Authorization header

I can make a GET request with an Authorization header from curl but not from request or https in Node.js. The server returns status 200 with curl but 500 with request or https. How might the call from request or https be different from curl? How…
prototype
  • 7,249
  • 15
  • 60
  • 94
2
votes
1 answer

Jasmine Testing Node.js Async modules

I\m trying to write unit tests for some code I wrote, the problem I'm running into is I expect my mock callback to be called after executing the function but my test fails as it is never called. describe("Asynchronous specs", function() { var…
user3221287
  • 337
  • 3
  • 12
2
votes
1 answer

Convert PNG from GET request to a Readable Stream in Node.js

I'm trying to make a Facebook chat bot that can send cat pictures. I use a RESTful API to get the cat pictures. They are returned as raw png. The next and final step is to convert that image into a Readable Stream so the Facebook Chat API can send…
renxinhe
  • 41
  • 1
  • 4
2
votes
1 answer

Incorrect TypeScript definition for request / request-promise: option "time" is missing

On NodeJS with TypeScript and using npm request-promise (which wraps npm request). I want to use the "time" option to time the round-trip as documented here "time - If true, the request-response cycle (including all redirects) is timed at…
Michael
  • 4,010
  • 4
  • 28
  • 49
2
votes
1 answer

Node.js and Requestjs: Pipe a Transform stream to Request.js as a file for upload

I am creating a zip file on memory using node-archiver ( https://github.com/archiverjs/node-archiver ). Using archiver's pipe feature, I pipe everything to a Transform stream. I can pipe this stream to a file if needed, but I would like to let…
noderman
  • 1,934
  • 1
  • 20
  • 36
1
2
3
9 10