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
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