Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Mark Liang
    @mark695073649
    oh never mind i got it
    ProfessorTom
    @ProfessorTom
    @mark695073649 what was the problem?
    Mark Liang
    @mark695073649
    when I first declared "options", i set the 'uri' field to "firsturl", then when I tried to make the second request, i set options.url to secondurl(when I should set uri, not url), so the request still goes to options.uri, which is firsturl. I was blind lol..
    ProfessorTom
    @ProfessorTom
    I almost suggested there was a problem with options but I too missed the two character difference.
    I hate bugs like that
    Mark Liang
    @mark695073649
    same, took me like five hrs to figured it out..
    ProfessorTom
    @ProfessorTom
    In the code you pasted, you used url in both places. Was there a problem elsewhere or did you retype the code before pasting it here and thus corrected your error when asking for help?
    Nicolai Kamenzky
    @analog-nico
    @ProfessorTom Could you do a small test where you execute some simple test without Typescript?
    Unfortunately, I don’t have time right now to look into it myself...
    @ProfessorTom One idea you could try in your Typescript environment: Instead of using await rp(…) you could use await rp(…).promise(). Since rp(…) returns a mixed object that is a certain request object and a promise at the same time that may confuse the runtime. .promise() returns just the promise and that should definitely work with await.
    Mahsa Maslahati
    @MahsaMaslahati
    Hi
    I'm using your wonderful library in one of my projects and something weird keeps happening, is there anybody who could help me here or I should create an issue?
    On my tests, sometimes req({option}).then() returns this error: "TypeError: req(...).then is not a function", I checked and on those cases req(...) is not a promise!
    It's just my options (a json object )
    So what am I doing wrong? Couldn't find anything on your issues
    Nicolai Kamenzky
    @analog-nico
    Hi @MahsaMaslahati , are you getting the error for the same line of code all the time or sometimes it work and sometimes it doesn’t? Could you paste one of your actual code snippets that doesn’t work here?
    Btw, you can also open an issue for that. Whatever you prefer.
    Fahad Murtaza
    @fahdi

    So my code looks like this

    return rp(options)        
            .then(response => {
                let timeEntries = JSON.parse(response)['time-entries'];                       
                return timeEntries;
            })
            .catch(err => console.log(err.MESSAGE));

    Which is a part of a method.

    I am getting this error Unhandled rejection Error: StatusCodeError: 400 - "{\"MESSAGE\":\"Invalid Parameters - 'page' must be greater or equal to 1\",\"STATUS\":\"Error\"}"

    What could be wrong
    Nicolai Kamenzky
    @analog-nico
    @fahdi You server is giving you a 400 response and tells you that your request is not proper. Not in a technical sense but in respect to its parameters. It seems you set options.qs.pageto a negative number.
    Fahad Murtaza
    @fahdi
    That is understandable but how to get rid of Unhandled rejection Error: or how to handle it properly. Doing throw new Error(err); didn’t work
    Nicolai Kamenzky
    @analog-nico
    @fahdi The way you use then and catch in the snippet is perfect. The only explanation I currently have for your unhandled rejection is that you actual code doesn’t match the snippet. Or the rejection came from a different request at another spot in your code. Could you double check?
    Fahad Murtaza
    @fahdi
    I will
    Mahsa Maslahati
    @MahsaMaslahati
    @analog-nico Thanks for your reply, but the problem was with my code, not the library. Thanks for your time.
    Ahmed Eid
    @a-eid
    How can I send an array of cookie objects with the request !
    Stephen James
    @sjames1958gm
    With request, I was able to get the status code passed in the callback.
    How do I get the status code with request-promise?
    Stephen James
    @sjames1958gm
    nvm - found option for getting response in entirety
    Nicolai Kamenzky
    @analog-nico
    @sjames1958gm Correct, you can use the resolveWithFullResponse option.
    @a-eid Sorry, I missed your message. Have a look at the cookie example. You can set multiple cookies there.
    Stephen James
    @sjames1958gm
    @analog-nico thx
    KernelDev
    @KernelDev
    Hi, is there an option to set a timeout on the request? Also could you provide a response time with the response object?
    Nicolai Kamenzky
    @analog-nico
    @KernelDev Have a look at the Request options. Request-Promise is built on top of Request and you can use all its options with Request-Promise as well. There is a timeout option. For the response time you can build a wrapper around your requests.
    KernelDev
    @KernelDev
    @analog-nico Thank you very much
    Pulkit Singhal
    @pulkitsinghal
    Where can I find release notes for each release? One of my modules is using a really old version 0.3.2 of request-promise and I'm seeing some issues where the request hangs indefinitely after a POST ... so I want to go through each version's release notes and find out which one might have fixed this issue or incorporated an update of request to fix such symptoms
    John Doe
    @peculiarity
    Hey guys
    I have
    import request from 'request-promise-native';
    creating a UMD module
    in the browser everything works fine
    when I get to NODE repl and inject my dist file
    TypeError: global.XMLHttpRequest is not a constructor
    This happens when I require my bundle ( using webpack)
    any ideas?
    John Doe
    @peculiarity
    ok I fixed that issue .. got new one ..
    andreas
    @andreasvirkus
    Hi all. I'm having issues setting my content-type header for a request containing files.
    .then(token => {
        return rest.post({
            uri: '/api/v1/upload',
            headers: {
                'Authorization': token,
                'content-type': 'multipart/mixed',
            },
            formData: formData
        });
    })
    the request still shows the value multipart/form-data
    am I setting the header wrong somehow?
    John Doe
    @peculiarity
    oook :)
    what do you want to upload ?
    Nicolai Kamenzky
    @analog-nico
    @pulkitsinghal Hey old pal, how are you doing? Have a look at the README. At the bottom there are all changes with the breaking changes being marked. At the top there are even migration steps you might need to take.
    Nicolai Kamenzky
    @analog-nico
    @andreasvirkus Have a look at the details about forms in the request README. Btw, all request options work for request-promise as well. Usually, you don’t have to set the header yourself. It’s set automatically when you e.g. use the formData option.