Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Nicolai Kamenzky
    @analog-nico
    If you choose to use request-promise-native first you can later just replace it by request-promise without any breaking changes.
    Of course not the other way around
    Derek
    @Ctesias
    Neat
    Nicolai Kamenzky
    @analog-nico
    😊👍
    ProfessorTom
    @ProfessorTom
    stupid question: what is the difference between request-promise and request-promise-native?
    Derek
    @Ctesias
    request-promise is built on bluebird and contains all bluebird's goodies, request-promise-native sticks to what's built in to ES6. Smaller footprint, fewer features. Faster? I dunno
    ProfessorTom
    @ProfessorTom
    @analog-nico if you were wondering what came of our session the other day, the answer is I still don't have things working and it's really frustrating and slightly depressing.
    dumb question: cookie jars passed into a function are passed by reference and not value?
    Nicolai Kamenzky
    @analog-nico
    Correct @Ctesias . Regarding the speed half a year or so back the official statement was that Bluebird is still faster than native promises. But that may have changed. Maybe they have the same speed now...
    @ProfessorTom Man, that’s unfortunate! Regarding your question, yes by reference. Otherwise the last example at the very bottom of the request README wouldn’t work.
    ProfessorTom
    @ProfessorTom
    fair comment. Reading comprehension is hard!
    Nicolai Kamenzky
    @analog-nico
    Haha
    ProfessorTom
    @ProfessorTom
    reading is a graduate level skill; reading comprehension is post-doctrinal work! :joy:
    vueresource dependence promise
    And the exception lock like about promise
    I have no idea to resolve it
    Nicolai Kamenzky
    @analog-nico
    Hey @liaotup , is request-promise actually involved here?
    I think it’s best if you contact the vue-resource community.
    Sam
    @liaotup
    I have searched but it is not exit in gitter
    But I know vue resource is dependent on promise. And exception log tips about promise
    Nicolai Kamenzky
    @analog-nico
    @liaotup “promise” doesn’t mean “request-promise”. This chat is for the request-promise library only. The vue.js community has a forum for your type of question: https://forum.vuejs.org They’ll be able to help you.
    Sam
    @liaotup
    Though this is the forum for vue.js,not the vue resource but thank you very mush!
    Nicolai Kamenzky
    @analog-nico
    @liaotup I saw many vue-resource related question on that forum. Anyway, happy coding!
    ProfessorTom
    @ProfessorTom
    hey @analog-nico FWIW, the problem I was having with cookies getting "updated" in cookieJars turned out to be a situation where I was using request-promise but forgot to put a return in front of the call to request so the cookie was getting updated, but because I wasn't waiting on the promise to resolve, I had authentication errors.
    experimenting previously, I wasn't able to get either body or request out of awaiting a call to request. I don't know if I was just doing something wrong or if I really can't await request. Would be really cool if one could do this though. It would make testing code a lot cleaner
    Nicolai Kamenzky
    @analog-nico
    Oh, haha. A classic @ProfessorTom. Do you mean await with request or with request-promise?
    ProfessorTom
    @ProfessorTom
    await with request-promise of course.
    Nicolai Kamenzky
    @analog-nico
    In which environment are you using await? Node? Babel? Also, there are issues in the repo. Maybe there is the answer already waiting for you. await should work.
    Mark Liang
    @mark695073649
    hey anyone knows why this happens?
    google it many times, thought it should work, but it doesn't , did i do anything wrong?
    firsturl = 'someurl.json';
    secondurl = 'some_second_url.json';
    request = require('request-promise');
    options = {
        url: firsturl,
        json: false,
        header: "some_username_password"
    }
    request(options)
        .then(function(data1) {
            var data_first = JSON.parse(data1); //results from the first url
    
            options.url = secondurl;
            request(options)
                .then(function(data2) {
                    var data_second = JSON.parse(data2);
                    console.log(data_second);
                    //why it prints the results from the first url???
                })
        })
    ProfessorTom
    @ProfessorTom
    @analog-nico I'm using Typescript on top of Node
    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\"}"