Questions tagged [request-promise]

NodeJS simplified HTTP request client 'request' with Promise support. Powered by Bluebird.

NodeJS simplified HTTP request client 'request' with Promise support. Powered by Bluebird.

Resources

Also check out the new libraries that are very similar to request-promise v4:

323 questions
15
votes
3 answers

request-promise download pdf file

I received multiple pdf files and must download it from a REST-API. After auth and connect I try to download the file with request-promise: const optionsStart = { uri: url, method: 'GET', headers: { 'X-TOKEN': authToken, …
Ckappo
  • 429
  • 1
  • 7
  • 21
10
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
  • 11,044
  • 31
  • 100
  • 173
10
votes
2 answers

Why is the Promise reject() in my jest.mock going to a then() rather than a catch()?

I have two files, getItemInfo.js to make API calls and getItemInfo.test.js which is the respective Jest test file. On the test file, I am mocking the http calling triggered by node module request-promise. The question is on the second code block,…
9
votes
3 answers

Alternatives to request-promise-native

I was looking for modern modules that implement basic HTTP methods such as GET, POST in Node.js. I guess the most popular is request. The async/await version of it is called request-promise-native. Recently I learned that these modules are being…
Sergey Avdeev
  • 800
  • 6
  • 14
9
votes
3 answers

Request-Promise throws "no auth mechanism defined" using async/await

I was just trying out async/await with request-promise and ran into this error: RequestError: Error: no auth mechanism defined at new RequestError (node_modules/request-promise-core/lib/errors.js:14:15) at Request.plumbing.callback…
spicypumpkin
  • 1,188
  • 1
  • 8
  • 20
7
votes
2 answers

Using Async await in react component

So I've created a component that shoots off post requests with props that I provide. Although I'm familiar with Async await I for some reason can't seem to get this to return the actual value of the fulfilled promise and instead just get…
Scottt
  • 95
  • 1
  • 1
  • 4
7
votes
1 answer

TypeError: str.trim is not a function (Request-Promise/Tough-Cookie)

I am having similar problem as discussed here: https://github.com/request/request-promise/issues/183 I am using Request-Promise@4.2.2 and Tough-Cookie@2.3.4 And getting the same error: TypeError: str.trim is not a function I also played around…
6
votes
3 answers

Nodejs async / await with delay

I have a problem with this code: var request = require('request-promise'); class Test{ constructor(){ } async Start(){ var response = await this.getResponse(); await console.log(response); } async getResponse(){ var options = { …
S.Testersen
  • 73
  • 1
  • 1
  • 5
5
votes
3 answers

Node.js - Working with an API limit of 5 requests per second

I've got a 'script' that does thousands of requests to a specific API. This API will only allow 5 requests per second (and probably it measures differently then me). To make the requests I'm using request-promise framework, and I've superseded the…
Jono
  • 2,883
  • 4
  • 29
  • 40
4
votes
0 answers

SSL Error When Connecting to HTTPS URL Using Node.js Request-Promise Library

const rp = require('request-promise'); const https = require('https'); const agentOptions = { host: 'localhost', port: 443, path: '/', rejectUnauthorized: false, …
Dessa
  • 237
  • 2
  • 13
4
votes
1 answer

Node.js script request using HTTP Range header is resulting in more bytes than requested.

I am attempting to write a Node.js script that takes in a URL (to download a file) specified through the command line. Using the HTTP Range request header the script downloads the file in a configurable number of chunks and chunk size and then…
TXRedking
  • 76
  • 1
  • 5
4
votes
1 answer

AWS Lambda external URI request error: connect ETIMEDOUT

I coded in my local dev environment a node.js function that does several requests to an external url-uri (asynchronously using bluebird and request-promise). It works fine, the function gets the results and save the information into the EC3…
4
votes
1 answer

Using Slack's API dialog_open from Firebase Cloud Functions

Goal A Slack Event-Subscription event is hitting my Firebase Endpoint, and then, a Firebase Cloud Function is using the dialog_open endpoint to open a dialog in Slack with some values from Firebase. Issue When the Firebase Cloud function hits…
4
votes
1 answer

Looping & Nesting Promises

I am using Request-Promise and cheerio to scrape some website data, essentially I am trying to achieve the following: Create An Empty Array Login Get some info from one page and push objects into the array Get some info from another page and push…
Chris Talke
  • 90
  • 1
  • 7
4
votes
1 answer

Convert garbled character to ISO-8859-1

I'm trying to grab some text from a Portuguese site that is encoded in ISO-8859-1 according to the meta tag. I'm using NodeJS and the request-promise package. What I get back, for example, is Alg�s I believe I need to convert that to ISO-8859-1 in…
pedroremedios
  • 677
  • 9
  • 36
1
2 3
21 22