Forum Discussion
MattV
2 years agoKhoros Staff
http.client.request is not synchronous, so the code will stop executing until some sort of response from the server, or a timeout.
I'm not sure I've made two http.client.request calls in one endpoint, but I'm not sure I see any major issues with doing that. Though if one or both http.client.request calls take a long time, it's possible the execution time of the endpoint exceeds the cloudfront timeout, so you might get a HTTP 504 Gateway Timeout error.
Obviously, if your 2nd request depends on results of the first, you'll want to make sure you validate the response of the first before you make the 2nd to avoid unnecessary calls.
Related Content
- 11 years ago