Recipe - Food - Nutrition

फ्रीमियम
Verified
द्वारा David | अपडेट किया गया 17 days ago | Food
लोकप्रियता

9.9 / 10

लेटेंसी

527ms

सेवा का स्तर

100%

Health Check

N/A

सभी चर्चाओं पर वापस जाएं

Empty result body

Rapid account: A Jackson 1996
aJackson1996
6 years ago

I copy and pasted the code for a nodejs get request to search for recipes; the status and headers are being retrieved properly but the body is coming back undefined. How can I fix this?

Rapid account: A Jackson 1996
aJackson1996 Commented 6 years ago

Sorry about that. Here is the request:
const query = this.state.search;
unirest.get(“https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/search?query=”+query)
.header(“X-Mashape-Key”, “LprAb5Rr2lmshfSBpHK5iKitS1ZTp1yjs3zjsnb0BptOvvMa9l”)
.header(“X-Mashape-Host”, “spoonacular-recipe-food-nutrition-v1.p.mashape.com”)
.end(function (result) {
const results = JSON.stringify(result.body.results);
console.log(results);
});

This request takes place upon the user hitting enter, which passes the data within an input field into “this.state.search”. The request returns headers and a status, and when I run the app in Microsoft edge it returns the body successfully, but when running the app on google chrome there is no request body sent.

Rapid account: Spoonacular
spoonacular Commented 6 years ago

This is way too little information to help out. What is the actual request being sent?

चर्चा में शामिल हों - नीचे टिप्पणी जोड़ें:

नई टिप्पणियाँ पोस्ट करने के लिए लॉग इन / साइनअप करें