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

Node Request piping data failure

I am trying to download about 800MB per file. This is the code to achieve it: function makeRequest(url,name,callback){ name = promObj.Name; requestsdone =-1; request(url,{auth:auth}, function…
PhilG
  • 351
  • 1
  • 4
  • 15
0
votes
1 answer

Node.JS Callback Scoping Issues

I'm using JavaScript classes to write a small tool for work. I don't like callbacks nesting and nesting, so I like to break them out into separate functions. I'm trying to run requests, which take a callback, from within a for...of loop. The problem…
user4158347
0
votes
1 answer

How to upload image using request npm module?

I am using request npm module. I have a gateway which acts as the middle man, takes request from outside and forwards it to the concerned microservice. For downloads, I have the following code. if ( req.baseUrl.match('download') || …
zegulas
  • 417
  • 2
  • 6
  • 18
0
votes
1 answer

Send local image to R function using opencpu

I am trying to use a local .png file as a function argument in this javascript function to pass it to OpenCPU: function processWithR(promObj) { return new Promise((resolve, reject) => { try { var url =…
PhilG
  • 351
  • 1
  • 4
  • 15
0
votes
2 answers

npm request moudule not giving the output

Why when I run the npm request module the output I get is undefined? const request = require('request'); request({ url: 'https://maps.googleapis.com/maps/api/geocode/json?address=1301%20lombard%20street%20philadelphia', json: true }, (error,…
0
votes
2 answers

Clio API: bulk actions not returning 303 status code

I'm not seeing a 303 response for bulk actions using latest v4 api for the activities endpoint. From The API Documentation: Make a request to the action with an X-BULK header with the value true. The response will always be a 202 Accepted. Poll…
t.888
  • 3,862
  • 3
  • 25
  • 31
0
votes
1 answer

Request npm module - Request inside of request

I am using request npm module and making 4 request inside of mainstream request. To say the conclusion first, only two of four request are succeed randomly. Here is my code below. router.get('/', function(req, res){ //TODO request(url,…
W. SONG
  • 33
  • 12
0
votes
0 answers

Sending body with headers - Request npm

I am using npm Request module to make a post request. I am able to send headers but not the body. As per documentation they have mentioned the way how to add headers, but not the way how to add headers+body. Here is my code: const functions =…
Noman Ali
  • 3,160
  • 10
  • 43
  • 77
0
votes
2 answers

Sending IP in the request header NPM

I am trying to send the server's IP (in this case, my computers public IP) to another server in a HTTPS request to get access to their API. I have completed the server authentication and I have my bearer token. I am using an Express and NPM for…
0
votes
0 answers

Node 'request' package, get string instead of object

let url = 'https://www.example.com'; let requestData = { "key": { "keyA": "value", } }; let options = { url: url, method: "POST", headers: { "Content-Type": "application/json", }, json:…
BangOperator
  • 4,377
  • 2
  • 24
  • 38
0
votes
1 answer

Catching invalid urls pre-redirection using the requests module

I have a nodejs app where a user can supply a url that is an external url, like www.google.com, or one that points to one of the webapp's pages, like A/B/C.aspx. To make sure that the url is valid, I have been doing: const request =…
pushkin
  • 9,575
  • 15
  • 51
  • 95
0
votes
1 answer

How to convert the request webservice as a function using javascript

I'm having the request script as below and saved as pageRequest.js. pageRequest.js: var request = require('request'); var options = { method: 'get', url: 'http://xx.xx.xx.x/api/....' }; function callback(error, response, body) { var info1 =…
KAK
  • 905
  • 4
  • 14
  • 33
0
votes
1 answer

Scope Issue (NodeJS - "request" package)

I'm having an issue with the scope of a variable. I need to be able to access "userLocation" outside of "request". The request package can be found at https://github.com/request/request Here's my code below: var request = require('request'); var…
dnesbeth
  • 1
  • 1
0
votes
1 answer

Curl -F POST request translation

What would be the HTTP equivalent of this cURL request? I've tried to translate and haven't been able to pass the file correctly to the API. $ curl -F "file=@test.txt" https://xxxxxx I've tried: const formData = { file: 'pathToFile' } request …
uma
  • 99
  • 5
0
votes
1 answer

Error: connect ETIMEDOUT when scraping

I have a function that: 1. gets an array of 3000 'id' properties from mongoDB documents from collection foo. 2. Creates a GET request for each ID to get 'resp' obj for id, and stores it in another database. router.get('/', (req, res) => { var…
Moshe
  • 2,583
  • 4
  • 27
  • 70