Questions tagged [node-request]

A node.js NPM package for handling HTTP requests.

Request.js is a popular package for which offers a simple HTTP abstraction layer with a comprehensive API / library for handling a range of common uses when making requests.


Documentation:


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.

332 questions
100
votes
9 answers

pass JSON to HTTP POST Request

I'm trying to make a HTTP POST request to the google QPX Express API [1] using nodejs and request [2]. My code looks as follows: // create http request client to consume the QPX API var request = require("request") // JSON to be passed…
Ronin
  • 7,322
  • 6
  • 36
  • 54
24
votes
6 answers

How to get cookies from request module in node.js?

function getCookies(){ request('http://google.com', function (error, response, body) { if (!error && response.statusCode == 200) { console.log(response.headers); } }) } Result { date: 'Fri, 11 Dec 2015 07:15:50…
ton1
  • 7,238
  • 18
  • 71
  • 126
21
votes
4 answers

Node.js GET Request ETIMEDOUT & ESOCKETTIMEDOUT

I'm using Node.js - async & request module to crawl 100+ millions of websites and I keep bumping into errors ESOCKETTIMEDOUT & ETIMEDOUT after few minutes. It works again after I restart the script. It doesn't seem to be connection limit issue…
Tan Hong Tat
  • 6,671
  • 2
  • 27
  • 25
15
votes
3 answers

Fail to call reddit's /api/submit

I couldn't get any help on reddit/r/redditdev so I'm hoping you fine folks at stackoverflow can help I'm trying to call /api/submit. I can successfully log the user in and retrieve the bearer/access token. (I use passport-reddit node module for…
kane
  • 5,465
  • 6
  • 44
  • 72
13
votes
2 answers

Nodejs Request Promise How to display status code

I am using the request library to make external api calls. https://github.com/request/request. I am using the native promise/async extention. https://github.com/request/request-promise-native. However I am not able to check the status code, it is…
Kay
  • 17,906
  • 63
  • 162
  • 270
12
votes
1 answer

Node request for certain site results in ETIMEDOUT error most of the time

Specs Here's some background info on the system I'm running: Ubuntu v 14.04 Node v4.4.0 Node request module v2.69.0 All of this on a DigitalOcean droplet/server on a New York-based center.   Problem Description So I run the following js file: var…
youngrrrr
  • 3,044
  • 3
  • 25
  • 42
11
votes
3 answers

document is not defined when attempting to setState from the return of an async call in componentWillMount

I grab my data in my componentWillMount call of my component [actually it's in a mixin, but same idea]. After the ajax call returns, I attempt to setState, but I get the error that the document is not defined. I'm not sure how to get around this. Is…
Sophie McCarrell
  • 2,831
  • 8
  • 31
  • 64
10
votes
1 answer

How to save JSON data to Google Firebase's Firestore database?

Is it possible to save JSON data directly to Firebase Firestore? I tried saving my below json data, Data [{"id":"1234","name":"Chair","symbol":"CHR"}] Code: request({url: 'https://api.example.com/v1/data', json: true}, function (error, response,…
Aravin
  • 6,605
  • 5
  • 42
  • 58
10
votes
1 answer

Fire a GET request and get the node Stream

I'm trying to send as formData, a stream from an image I get using request The problem is that the request is fire after the formData request. Is there any way I can pipe the image request to recognize? but with the freedom of adding parameters to…
German Attanasio
  • 22,217
  • 7
  • 47
  • 63
9
votes
2 answers

Multiple paginated GET API calls in parallel/async in Node

I am making call to the bitbucket API to get all the files that are in a repo. I have reached to a point where I can get the list of all the folders in the repo and make the first API call to all the root folders in the repo in parallel and get the…
Grinish Nepal
  • 3,037
  • 3
  • 30
  • 49
9
votes
2 answers

Fetch vs Request

I'm consuming a JSON stream and am trying to use fetch to consume it. The stream emits some data every few seconds. Using fetch to consume the stream gives me access to the data only when the stream closes server side. For example: var target; //…
sparkFinder
  • 3,336
  • 10
  • 42
  • 57
9
votes
1 answer

What is the equivalent of curl --upload-file in node-request

I'm using node-request and trying to send a file to IBM's HDFS, as per this documentation. Passing this JSON object to request successfully uploads: var options = { method: 'put', body: 'foo', headers: { …
thekevinscott
  • 5,263
  • 10
  • 44
  • 57
8
votes
3 answers

node express/request: piping a POST request with body parsing

I'm attempting to pipe a request for handling by a remote server, along the following lines: var destination = request(url); req.pipe(destination).pipe(res); This works just fine for GET requests. But for POST requests I'm struggling. An…
drmrbrewer
  • 11,491
  • 21
  • 85
  • 181
8
votes
1 answer

Download an image using node-request, and fs Promisified, with no pipe in Node.js

I have been struggling to succeed in downloading an image without piping it to fs. Here's what I have accomplished: var Promise = require('bluebird'), fs = Promise.promisifyAll(require('fs')), requestAsync =…
Selfish
  • 6,023
  • 4
  • 44
  • 63
7
votes
0 answers

How to safely abort a piped stream in NodeJS?

I'm using Requests to pipe an HTTP Stream to a local geospatial file-processing utility, ogr2ogr: httpStream.on('response', function(response) { var ogr = ogr2ogr(response) .skipfailures() …
Steve Bennett
  • 114,604
  • 39
  • 168
  • 219
1
2 3
22 23