Http.get is not providing or ignoring options, agent string and timeout?

I run into a problem with http.get, as a particular server seems to timeout and not respond with the user agent.

Seems also like I can’t set a timer for the request or change the agent string?
Is this true?

1 Like

Bump… is there a working way to set a timeout for an http request? Otherwise it just breaks my automation.

Hi @dirk_s,

thanks for sharing your issue! Currently, the built in Tape HTTP client exposed in workflow automations does not have a timeout setting. Feel free to create a dedicated feature request for that missing functionality, it might be easy to implement for us in the future.

Meanwhile, you could leverage async JS and try something like this:

/** Your timeout in milliseconds */
const TIMEOUT_MS = 5_000;

// launch a delayed promise and fail if reached without the http call finishing first
let success = false;
delay(TIMEOUT_MS).then(() => {
    if(!success) throw Error('Timeout, sorry')
});

// ... perform your request:
const result1 = await http.get("http://google.com");
console.log('Request finished without timeout.')
success = true;

Together with the “Continue on error” option that might help with your use case:

Let us know!
Good luck
Tim

1 Like

Thanks Tim for this response - I will try it and give feedback!

2 Likes