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
3
votes
1 answer

NPM Verdaccio - set uplink to own remote server

I just built an NPM Verdaccio private registry server within our local network and I would like configure an UPLINK to our remote NPM Verdaccio server which is hosted at AWS (and also keep the original npmjs registry). snippet from Verdaccio…
nex.cz
  • 154
  • 1
  • 3
  • 11
3
votes
1 answer

nodejs convert from import to require

I'm getting into a case not covered in How to bulk convert some javascript code from import to require?. Here is the original code from npm package hot-import: import * as assert  from 'assert' import * as fs      from 'fs' import * as path    from…
xpt
  • 20,363
  • 37
  • 127
  • 216
3
votes
1 answer

Limit concurrent requests to API in NodeJS along with Async/Await

I am using Request package in my Nodejs project along with Async/Await functions introduced in Node V.8.x to consume 3rd party API, everything was fine until I come across a restriction from API provider; who has restriction of 10 concurrent…
Nagaraja Malla
  • 144
  • 1
  • 10
3
votes
2 answers

How can I send a file to Facebook Send API using npm's Request without uploading the file?

I'm implementing a bot that uses Facebook's Send API. According to the documentation it is possible to send files using a request. The documentation offers two methods, one sending a URL to the file and the other uploading the file. I don't want to…
3
votes
2 answers

Node js for-loop wait for asynchronous function before next iteration?

I am making a function that refreshes data every so often and I am having issues with the request chain that I have. The problem is that I have a for-loop running the asynchronous requests and the for-loop will finish before the requests are…
NightShadows
  • 103
  • 1
  • 9
3
votes
1 answer

How can I create a calendar event on Outlook with Microsoft Graph API?

I have an app that integrates with Office365 and I am attempting to create a calendar event on an Outlook calendar using the Microsoft Graph API. Here is what I have so far: request.post({ …
ChrisPaterson
  • 125
  • 2
  • 10
3
votes
2 answers

converting string to JSON causing problems (Node.Js & request module)

I'm requesting data from an api that isn't configured properly. It serves as text/html, but when I run JSON.parse(data) I get an parse error. and I do data.trade it says undefined. If I just echo the data it looks like this (sample, not the full…
chovy
  • 72,281
  • 52
  • 227
  • 295
2
votes
1 answer

NodeJS `request` library fails to post files via multipart-form-data to dotnet server

I am using the [officially deprecated] request library [1], which uses the form-data library [2] to post the file data. For various reasons, switching to an active and maintained http request library is not in the cards at present. After upgrading…
Brandon
  • 53
  • 5
2
votes
0 answers

Unable to install puppeteer

I have written the command npm i --location=global puppeteer to install puppeteer. writing npm install -g puppeteer also produce the same error: C:\windows\system32>npm install -g puppeteer npm ERR! code 1 npm ERR! path C:\Users\NITU…
2
votes
1 answer

Function returning undefined seems like console.log is running before result is returned? Promise needed?

I have a function in another file that I want to get the response of and then do something with that response before exiting my controller function. Here is the code from the required file: exports.counter = function(companyID) { …
joshk132
  • 1,011
  • 12
  • 37
2
votes
1 answer

The request body must contain the following parameter: 'grant_type'... but I put it in the body

I put the grant_type parameter in the request body as the documentation shows, but Microsoft Graph still complains that it's not there; const tokenRequestBody = [ "grant_type=client_credentials", …
AskYous
  • 4,332
  • 9
  • 46
  • 82
2
votes
1 answer

How to pipe() npm-request only if HTTP 200 is received?

I have the following code: let request = require('request'); let fs = require('fs'); request.get('http://localhost:8080/report.rtf') .pipe(fs.createWriteStream(__dirname + '/savedDoc.rtf')); It works well, but only if the document is…
Mikser
  • 929
  • 10
  • 16
2
votes
1 answer

Using Async/Await with npm request module

I am currently trying to send some request with the npm request module. The normal callback variant works very well but I am not able to do the same with async await. At first I tried to do it with 'request-promise-native' module but I am not able…
Ruvi
  • 253
  • 4
  • 15
2
votes
0 answers

Workaround from client side for invalid HTTP response headers that contain both Transfer-Encoding and Content-Length?Can see response using Postman

I'm calling an API that returns 5 keys in the header including Transfer-encoding:chunked and Content-Length values, in the header. According to stackoverflow question, and this below, this is illegal: "...Node.js server returns a parse error with…
ajivani
  • 414
  • 1
  • 6
  • 11
2
votes
0 answers

Node.js request module returns unicode characters

I'm using the request module and I'm getting a status code of 200 but the body looks like this: ��N�0��w9׃t�"���M�� c� ��@\�=���c���}�_YR���c�cߦZ�#�&�Z�~��m�F���+e�{s���gR/����Z�����f7)����Hq�3h�� ... how can I fix it to return a json response? This…
Valip
  • 4,440
  • 19
  • 79
  • 150
1
2
3
10 11