# How to cancel HTTP Request

**URL:** <https://discourse.nodered.org/t/how-to-cancel-http-request/73733>\
**Category:** General\
**Created:** [16 January 2023 00:25 UTC](https://discourse.nodered.org/t/how-to-cancel-http-request/73733 "2023-01-16T00:25:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ralbright-wa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralbright-wa/32/69889_2.png) [@ralbright-wa](https://discourse.nodered.org/u/ralbright-wa)\
**Post date:** [16 January 2023 00:25 UTC](https://discourse.nodered.org/t/how-to-cancel-http-request/73733/1 "2023-01-16T00:25:55Z")

</div>

I am using HTTP Request to send aRest commands to some arduinos. These commands initiate a reset of the arduino, however I do not get a response (for obvious reasons) from the Arduino, and so each of the HTTP Requests eventually time out. Is there a way to send a command to a HTTP Request to immediately stop the request?

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [16 January 2023 05:55 UTC](https://discourse.nodered.org/t/how-to-cancel-http-request/73733/2 "2023-01-16T05:55:41Z")

</div>

Set:

> `requestTimeout`  
> If set to a positive number of milliseconds, will override the globally set `httpRequestTimeout` parameter.

---

<div class="post-metadata">

**Author:** ![ralbright-wa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralbright-wa/32/69889_2.png) [@ralbright-wa](https://discourse.nodered.org/u/ralbright-wa)\
**Post date:** [21 January 2023 23:39 UTC](https://discourse.nodered.org/t/how-to-cancel-http-request/73733/3 "2023-01-21T23:39:46Z")

</div>

@bakman2  
Thank you, but I do not understand exactly what you mean. Do I use a function node and set msg.requestTimeout to a positive number then also pass this to the HTTP Request?

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [22 January 2023 07:59 UTC](https://discourse.nodered.org/t/how-to-cancel-http-request/73733/4 "2023-01-22T07:59:45Z")

</div>

If you click the http request node _once_ and click the book on the right, it will provide you with the documentation for the node (this applies to most nodes), which explains that you can set a message property to adjust its behaviour.

So yes, you can set `msg.requestTimeout` with a value using a change node or a function node.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [22 January 2023 08:28 UTC](https://discourse.nodered.org/t/how-to-cancel-http-request/73733/5 "2023-01-22T08:28:38Z")

</div>

In the Arduino, respond to the request and wait a short time for it to be sent, before resetting.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [23 March 2023 08:29 UTC](https://discourse.nodered.org/t/how-to-cancel-http-request/73733/6 "2023-03-23T08:29:26Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
