Questions tagged [npm-request]

npm-request is a node package designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default.

npm-request is a node package designed to be the simplest way possible to make HTTP calls. It supports HTTPS and follows redirects by default.

Useful links

158 questions
0
votes
2 answers

request inside another request using params from first request in a loop

Hello guys I'm trying to use the values received from the first api url request as params of the second api url. Therefore, I've created a for loop and with the idea that for every element in the array I'm iterating will send it as the parameter…
Defoe
  • 371
  • 1
  • 5
  • 17
0
votes
2 answers

Express.js - Use nested request to get JSON from backup URL

I have two URLs that have a .json.gz file - var url = "http://post.s3post.cf/s3posts.json.gz"; var backupURL = "https://s3-us-west-2.amazonaws.com/s3post.cf/s3posts.json.gz"; I'm able to successfully use the request module to get json from the file…
Anish Sana
  • 518
  • 1
  • 12
  • 30
0
votes
1 answer

Get variable outside module request when asynchronous

Hi I'm trying to get the id variable that it's returned inside request in an asynchronous process using request and cheerio. I've tried by returning a Promise but that didn't work. let id; request(mainUrl, function(err, res, body) { …
Defoe
  • 371
  • 1
  • 5
  • 17
0
votes
1 answer

node.js - How should I organize my code? What I got now isn't reliable

I get an issue where some code writes to the console late or in random order, where did I go wrong? var request = require('request'); var vFind = 'HelloWorld'; var vFound = false; var vSites =…
0
votes
2 answers

Node JS: How do I request multiple source codes from different websites?

I get an issue where If I try to use request more than once, it doesn't work. I can give an example: request('https://www.google.com', function (error, response, vBody1) { request('https://www.purple.com', function (error, response, vBody2) { …
0
votes
2 answers

npm request send token and header 'content-type': 'application/json' at the same time

I'm trying to get a response back from an API by sending the token and the header 'content-type': 'application/json', but I don't know where should I put them. This is my code so far: var request = require('request'); request.get('google example…
Defoe
  • 371
  • 1
  • 5
  • 17
0
votes
1 answer

Sending image file from http request in Node.js

I am trying to setup an API that will return an image from my google places API using google's photo reference ID as a parameter. This is what I have so far: module.exports.getPhoto=function(req,res){ var id=req.params.id; var…
0
votes
1 answer

Conditional chaining of promises

I want to chain my promises depending upon if the previous call was resolved or rejected. I am making a call to server in all promises. So, I am writing it like- apiServices.patientsSearch(id) .then(function(data){ return…
Krrish Raj
  • 1,505
  • 12
  • 28
0
votes
1 answer

how to parse" http GET request"'s text response in nodejs?

I make a HTTP GET request to Facebook to have a long live token , as a response I have a plain text with the access token and expiration date , but I don't know how to parse…
Sam
  • 2,673
  • 2
  • 15
  • 20
0
votes
1 answer

node request module - sample request failing

I'm currently using node 7.6.0 and am trying the npm request module 2.80.0. The module is installed via package.json npm install. Following their simple example I immediately get: "Failed: Cannot set property 'domain' of undefined". Its a straight…
awaken
  • 789
  • 1
  • 11
  • 22
0
votes
1 answer

npm request wait before reading body

I am trying to use npm request and cheerio to pull webpages and parse their html. This works fine for cases where the html is loaded on request. But I am having an issue where the site loads a loading screen first and then updates the page with new…
alex_milhouse
  • 891
  • 1
  • 13
  • 31
0
votes
1 answer

How to pass json to nodejs request post method?

I try to pass json to nodejs post method.But i'm getting error "The search query must be specified.". I have specified search string and filter the code. Can you advise what cause this error. Same request working in POSTMAN. //Load the request…
user2848031
  • 187
  • 12
  • 36
  • 69
0
votes
1 answer

How to properly read POST params with express?

My node app is supposed to POST to an external server, so I'm playing with request from NPM. I want to verify it's working, but I'm not entirely sure I'm doing that right. I've tried both of these methods request({ url: url, method: 'POST', …
Dave Stein
  • 8,653
  • 13
  • 56
  • 104
0
votes
0 answers

Socket doesn't restart properly

I am using socket io and node for my chat application. There are two problems 1) Continuous increase in RAM usage by socket 2) I used pm2 to monitor socket, it starts and working perfectly, RAM usage increases and it goes above 100MB and after…
Sachin Singh
  • 391
  • 1
  • 5
  • 20
0
votes
1 answer

Where do you place NPM's request code?

I want to use the request module in my express app, but I am not sure where the actual requests code goes. Usage: When a user loads a page, make a GET request and populate the page with data. When a users clicks on a item from a table, make a GET…
anonameuser22
  • 108
  • 12