Hi Everyone I am Emmanuel Katto from Dubai, United Arab Emirates (UAE), I need to set a time limit on the HttpClient.send method in Apigee Edge using JavaScript. However, I want to avoid using the JS policy to set the timeout and need to handle it directly within the JavaScript code.
I tried the following code, but it does not work:
var authRequest = new Request(context.getVariable('url'), "POST", header, formBody(payload));
var response = httpClient.send(authRequest, response => {
fetchAuth(response);
}, 1000); // timeout set to 1 second
Regards
Emmanuel Katto
Hi @phillipjames, thank you for engaging with the Apigee community! We’re keeping an eye on your question and encourage other members to share their expertise if they can. We’ll ensure you get a response. 🙂
Hello
The httpClient.send method in Apigee's JavaScript does not support a direct timeout parameter. The timeout in your example (1000 as the last parameter) does not apply, as Apigee's httpClient.send method does not include a built-in timeout configuration. However, you can implement a workaround by using the setTimeout function in JavaScript to simulate a timeout and manage the response.