Skip to content

await/async or .then options #137

@t5unamie

Description

@t5unamie

I am trying to chain many unirest calls one after another where by I make decisions based on the previous rest call.

The problem is normal patterns I normally use don't work with unirest and I am trying to work out why.

what seems to happen is the .then is not respected

await unirest.get("https://apidojo-yahoo-finance-v1.p.rapidapi.com/stock/v2/get-financials").headers({ "x-rapidapi-key": process.env.RAPITOKEN, "x-rapidapi-host": "apidojo-yahoo-finance-v1.p.rapidapi.com", "useQueryString": true }).query({ "symbol": TICKER, "region": "US" }).then( async (resFIN) => { <nest unirest request here> }

another pattern I tried is
var something = await unirest.get("https://apidojo-yahoo-finance-v1.p.rapidapi.com/stock/v2/get-financials").headers({ "x-rapidapi-key": process.env.RAPITOKEN, "x-rapidapi-host": "apidojo-yahoo-finance-v1.p.rapidapi.com", "useQueryString": true }).query({ "symbol": TICKER, "region": "US" }).then( async (resFIN) => { <nest unirest request here> }

What I get back in this situation is defined.

when I try https://stackoverflow.com/questions/39604262/returning-a-promise-from-the-unirest-client

I don't get the body back. I only get the request details made.

Is there something I am missing about unirest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions