# Use Weak Indicator for ETag in http-request node header

**URL:** <https://discourse.nodered.org/t/use-weak-indicator-for-etag-in-http-request-node-header/78915>\
**Category:** General\
**Tags:** http-request\
**Created:** [3 June 2023 07:37 UTC](https://discourse.nodered.org/t/use-weak-indicator-for-etag-in-http-request-node-header/78915 "2023-06-03T07:37:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dtillner](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@dtillner](https://discourse.nodered.org/u/dtillner)\
**Post date:** [3 June 2023 07:37 UTC](https://discourse.nodered.org/t/use-weak-indicator-for-etag-in-http-request-node-header/78915/1 "2023-06-03T07:37:06Z")

</div>

I need to set the weak indicator in the HTTP header of the http-request node.

The raw header should look like:

```auto
If-Match:W/"JzE5OfC4OTI2MjglMTM1MjIWODgyMzcxOzAwOyc="

```

Note the leading W/ before the double quotes. This indicates a weak validation of the ETag. See:

> **[ETag - HTTP | MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag#directives)**
>
> The ETag (or entity tag) HTTP response header is an identifier for a
> specific version of a resource. It lets caches be more efficient and save bandwidth, as
> a web server does not need to resend a full response if the content was not changed.
> ...

I tried to add the header by a function node:

```auto
msg.headers = {};
msg.headers['If-Match'] = 'W/"JzE5OfC4OTI2MjglMTM1MjIWODgyMzcxOzAwOyc="';

```

This of course results in a wrong header formatting:

```auto
If-Match: "W/"JzE5OfC4OTI2MjglMTM1MjIWODgyMzcxOzAwOyc=""

```

I tried different ways of encoding the double quotes. But this does not work as W/ needs to be outside of the quoted value.

Is there a way to set the raw header of a http-request node?

Thank you for any help.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [3 June 2023 09:03 UTC](https://discourse.nodered.org/t/use-weak-indicator-for-etag-in-http-request-node-header/78915/2 "2023-06-03T09:03:30Z")

</div>

Reading the MDN specs the W/ is part of a response header sent in a response not a request header.  
So would not be sent in the [If-Match](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match) header.

---

<div class="post-metadata">

**Author:** ![dtillner](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@dtillner](https://discourse.nodered.org/u/dtillner)\
**Post date:** [4 June 2023 09:19 UTC](https://discourse.nodered.org/t/use-weak-indicator-for-etag-in-http-request-node-header/78915/3 "2023-06-04T09:19:26Z")

</div>

Ok. Sending the ETag without the weak indicator works.

Thank you very much.

---

<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:** [18 June 2023 09:19 UTC](https://discourse.nodered.org/t/use-weak-indicator-for-etag-in-http-request-node-header/78915/4 "2023-06-18T09:19:47Z")

</div>

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