Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
Davide De Gennaro
you can also use https://github.com/request/request-promise with await to make your code easier to read ;)
Alexsander Uglin
HI, can not install. Type npm install --save request and nothing happends.
Ian Sabey
im curious, is there a reason i can not send my response object out of the request function? Or is there a way to do so so that it can be accessed by more code than just the request? For example: i have a request inside an async function for a bot, the function makes a call out to a build server api and returns a json object. I loop over and get it all pretty etc etc but that new object is inaccessible causing me to not be able to return in in slack. Right now i can only log it in console.
btw i posted here because i dont like opening issues unless its an issue
Hey all, I had a really confusing encounter today. When I make a call to http://localhost:XXXX it gets converted to, which causes a connection refused when using it locally 😞 is there a way to stop this, and make it just use the hostname it’s given?
Timothy Jones
Hello, I'd like to use the latest version of request, but I notice the Travis build fails for 2.88.0. Should I use the most recent passing version, 2.87.x?
I'm trying to sign in to a website using request, but when am creating a new request it's starting a new session, what should I do?
Hey Guys, I want to request a csv-file and step through step by step but i dont know really how to combine, "request" with the streams cause readables/writeables are only allowed for buffers or paths. any ideas or hints?
Jayakumar Jayaraman
Hi Guys.. how to use API path parameter in the request library, please? Do I need to set it in the options? I know its availble in req.params.xxxx but now sure how to pass it into request library. Thanks a ton.
Walle Cyril
Question is not clear
what does it mean to use API path parameter ?
give at least 1 example of ideal input and expected output
example url handled by express POST and expected HTTP call with request (header + body)
Patrik Túri
what is the best way to check if the request was successful?
Is this ok:
if(!error && response.statusCode >= 200 && response.statusCode < 400)
Walle Cyril
Looks good to me
Mike Chen
@patrikturi I think '< 300' is better.
because request default follow the redirects
Ruvi Mackinaw

I have a little problem for whatever reason I am not able to pipe responses to the filesystem.
I am using npm: request-promise-native and my setup is rather simple :

var receivedReq = await request(buildReq);

I see the request object full everything is where but he just creates an empty file in the filesystem.
Can anyone give me a hint?

Walle Cyril
let token;
when you have result
token = result;
Yeah, I tried that. Something like
let token = null
request(url, (error, reponse, body) => {
token = body.access_token;
Token will be null.
Walle Cyril
you need to think the asynchronous way
your code is not executed line by line in the same order as the lines
I know that. That's why I'm asking for help.
I'm trying to have a top level token that can be passed around to the other requests so I don't have to generate one for each request.
it will help you
so you know how to use .then()
use it
I am very much new for API automation. I am planning to use request module with type script along with Mocha
I already have my UI framework on protractor/type script with mocha
can anybody help me to start with API Automation
I am facing the issue
I want to store a cookie received from 'post request' and send it on 'get request'. how can i do it?
setting jar: true in request did not help
Hello , I have a security/performance question , I want to POST to a callback url , the callback url is a url come from end-user , And it can be dangerous for our server , I want to POST a json to the callback url (Hooks), I WANT TO BE SAFE, I set 10 seconds timeout , but I am worry about response , malicious user can send 1TB response and I can fail our server , or may be some other consideration that I am umware , I validate url to have tld to prevent localhost calls
How can I ensure safty? How can I ignore response?
@everybody how can I ignore response of POST ?
@sm2017 I guess you are programming a client and a server? The client uses request, right? What does the server use? I can imagine that you could limit the body of the request on both sides.
If you have an nginx in front of your node, then you could set the limit there. Or express in node has also a limit setting on bodyParser. depends what you are using server side... or you have a stream, if you process large data, mesure it and drop it if it get's too large.
Hey just looking for some help, when I run a loop containing a GET request I seem to use a lot of memory. Possibly someone here could help with my issue? I posted a thread on Stack Overflow and in the example used axios although the issue was still present when I used request.js https://stackoverflow.com/questions/54902051/node-js-api-request-loop-without-a-memory-overload
Artem Biryukov
@everybody I have multiple separate requests and each one of them is dependent on another, my problem is that cookie are not preserved on each of them.
Jim Amsden
Is there any convenient way to support JEE form based authentication? Does request.js support registration of request and/or response interceptors that could be used to handle such an authentication challenge?
Christopher Deli
Hey, can someone please tell me how I disable sending a Content-Lenght header in request?
Hey! I'm using request to upload a file to a signed url in AWS S3 using formData: { [name]: fs.createReadStream(filePath) }. Everything seems to work fine, however it adds ----------------------------237294480337614270082104 Content-Disposition: form-data; name="name.html"; filename="name.html" Content-Type: text/html to the top of every file, which shows when displaying the html file somewhere else, and makes video files unusable. Why is it adding this? Is this something with request?