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
2 answers

Assign requestjs response to variable

How would one assign the body of request.get('http://someurl/file.json', function(err, response, body) {}) to a variable? For example: file.json { "Name1": { "prop": "value" }, "Name2": { "prop": "value" …
stackunderflow
  • 1,644
  • 6
  • 24
  • 40
1
vote
1 answer

Why does requestjs reject a self-signed SSL certificate that works with Firefox?

Here's the situation. I created a self-signed CA certificate, and used it to sign a second certificate for use with https. The web server is nginx doing SSL termination and reverse proxying to an expressjs application. To verify that the chain of…
Fizzbuzz97
  • 719
  • 1
  • 6
  • 14
1
vote
4 answers

Asynchronous Request Within a ForEach in node.js

I am new to node.js (and to request.js). I'd like to get the body of a website back from a specific url with different paths (in the example below http://www.example.com/path1, http://www.example.com/path2, etc.) and log this data in an object with…
Bannerman
  • 101
  • 1
  • 12
1
vote
0 answers

Set up proxy for scraping with nodejs using request and cheerio

I'm trying to set up a basic scraper using request and cheerio. The problem is that I need to GET the websites from different geos to monitor differences in the ads being displayed and the actual content. It was fairly easy to set it up without the…
galatron
  • 31
  • 6
1
vote
1 answer

Incredibly slow outbound HTTPS requests

I am using Node 0.12.2 with Express 4.13.3 as the frontend for a RESTful layer. Calling the API's from cURL/Postman takes ~9ms. However, using Request 2.60.0 to make the call from Node, it takes ~60ms. These are HTTPS calls. Removing HTTPS and using…
Jeff
  • 159
  • 10
1
vote
1 answer

Using request to get API results, and integrating into Hubot response

I have a Hubot plugin, that listens for JIRA webhooks, and announces in a room when new tickets are created: module.exports = (robot) -> robot.router.post '/hubot/tickets', (req, res) -> data = if req.body.payload? then JSON.parse…
victorhooi
  • 16,775
  • 22
  • 90
  • 113
1
vote
1 answer

Best way to scrape and parse html in nodejs with request package

It has come to my attention, during my experimentation that I am unable to parse the text received from request.get with either the htmlparser or htmlparser2 packages. In comparison to https.request the string returned is not the same, line breaks…
1
vote
1 answer

How to return image in NodeJS after intercepted image get request?

I am trying to intercept requests for html elements (like images and scripts) that is referenced with relative path from my website and retrieve them from a 2nd website using requestJS for NodeJS , this works with scripts but I can’t figure a way to…
tahayk
  • 492
  • 1
  • 5
  • 20
1
vote
0 answers

Node.js is not sending cookies

I use node.js to collect messages and notifications from 10 different websites and then I send them to my email account (something like daily report). I have done this job for 5 different websites, but now I'm having issues with Amazon. What I need…
MrD
  • 2,423
  • 3
  • 33
  • 57
1
vote
2 answers

Query sailsjs blueprint endpoints by id array using request

I'm using the request library to make calls from one sails app to another one which exposes the default blueprint endpoints. It works fine when I query by non-id fields, but I need to run some queries by passing id arrays. The problem is that the…
galactocalypse
  • 1,905
  • 1
  • 14
  • 29
1
vote
0 answers

Error while piping POST request using request library

I'm using request to communicate between two Sails applications. The concerned actions seem to get triggered but the form data shows undefined. In app A: The concerned form
galactocalypse
  • 1,905
  • 1
  • 14
  • 29
1
vote
1 answer

http request function won't return result

I am setting up a server with Express.js and I want a 'GET' request to '/' to return the results of a function. The function is making an get request from a news API. When I make the call to '/', the function is being triggered, and the results…
0
votes
2 answers

handle request.js error in node application

I am using request to access data from an api. sometimes, when the api Url is down, node throws error and shuts down with the following error at ClientRequest.emit (events.js:315:20) at TLSSocket.socketErrorListener…
Hello World
  • 79
  • 1
  • 6
0
votes
1 answer

handling request errors in node

I am using request to access data from an api. sometimes, when the api Url is down, node throws error and shuts down with the following error `at ClientRequest.emit (events.js:315:20)` `at TLSSocket.socketErrorListener (_http_client.js:426:9)` …
Hello World
  • 79
  • 1
  • 6
0
votes
1 answer

How do I click a button on a website using Requests in Node JS

I want to click the test product on this page: https://biscuit-bird.myshopify.com/collections/all I am trying to go fully request based and not use a headless browser like puppeteer or zombie as I have already done that. Please let me know how to do…
Salvatore Timpani
  • 407
  • 3
  • 6
  • 26