# How to send request payload?

**URL:** https://discourse.nodered.org/t/how-to-send-request-payload/60530
**Category:** General
**Tags:** http-request
**Created:** [30 March 2022 11:12 UTC](https://discourse.nodered.org/t/how-to-send-request-payload/60530 "2022-03-30T11:12:30Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ketpa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ketpa/32/42496_2.png) [@ketpa](https://discourse.nodered.org/u/ketpa)
#### Post date: [30 March 2022 11:12 UTC](https://discourse.nodered.org/t/how-to-send-request-payload/60530/1 "2022-03-30T11:12:30Z")

</div>

How to send request payload?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/3/835c285f1f41ce5c920acaa8f652de073d0efb99.png)  
and request header  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/1/c1f5fa9e8a02c7a59db1abe385781d3a8d87b63e.png)

I trying like this

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/c/7cc6e1b03f7c6b4819bc0bfd0bf3d49325ba9f17.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/1/01fe08856960cc47326b7de4b8a716b9bba5091b.png)

```auto
[{"id":"a8faa7af.39251","type":"inject","z":"e0cba348.b7758","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":1040,"wires":[["c9a82937.cfd908"]]},{"id":"1739859a.658f4a","type":"http request","z":"e0cba348.b7758","name":"","method":"POST","ret":"txt","paytoqs":true,"url":"http://10.0.0.66/chema/php/action_sensors.php","tls":"","persist":false,"proxy":"","authType":"","x":470,"y":1040,"wires":[["634cb9cb.180148"]]},{"id":"c9a82937.cfd908","type":"change","z":"e0cba348.b7758","name":"","rules":[{"t":"set","p":"headers","pt":"msg","to":"{\"Accept\":\"application/json, text/plain, */*\",\"Accept-Encoding\":\"gzip, deflate\",\"Accept-Language\":\"pl,en-US;q=0.7,en;q=0.3\",\"Connection\":\"keep-alive\",\"Content-Length\":\"21\",\"Content-Type\":\"application/json\",\"Cookie\":\"PHPSESSID=v5j02gqcu4snuetk3b97tluioa\",\"DNT\":\"1\",\"Host\":\"10.0.0.68\",\"Origin\":\"http://10.0.0.68\",\"Referer\":\"http://10.0.0.68/chema/php/action_sensors.php\",\"User-Agent\":\"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0\"}","tot":"json"},{"t":"set","p":"payload","pt":"msg","to":"{\"action\":\"fetchall\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":1040,"wires":[["1739859a.658f4a"]]},{"id":"634cb9cb.180148","type":"debug","z":"e0cba348.b7758","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":630,"y":1040,"wires":[]}]

```

and response

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/e/ae3d8740765a15b3d28347c791b2b2c6629739f3.png)  
How to decode?

---

<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: [30 March 2022 11:15 UTC](https://discourse.nodered.org/t/how-to-send-request-payload/60530/2 "2022-03-30T11:15:21Z")

</div>

The request header states `gzip, deflate`, meaning, it is gzipped, you need to ungzip the content. There is a gzip node available I believe.

---

<div class="post-metadata">

### Author: ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)
#### Post date: [30 March 2022 11:28 UTC](https://discourse.nodered.org/t/how-to-send-request-payload/60530/3 "2022-03-30T11:28:16Z")

</div>

> [@bakman2](#):
>
> The request header states `gzip, deflate`

Nice catch -- so if those headers are not passed in, would the payload NOT be gzipped?

---

<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: [30 March 2022 11:31 UTC](https://discourse.nodered.org/t/how-to-send-request-payload/60530/4 "2022-03-30T11:31:06Z")

</div>

I don't think so, if the server code has been setup to gzip encode the content (regardless of the header), it will be delivered gzipped with a gzip response header too. For the request, it could be a requirement as the server will also try to ungzip the request.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [30 March 2022 11:49 UTC](https://discourse.nodered.org/t/how-to-send-request-payload/60530/5 "2022-03-30T11:49:59Z")

</div>

> [@bakman2](#):
>
> I don't think so,

But it is worth a try - the server _should_ honor the accept encoding header.

---

<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: [13 April 2022 11:50 UTC](https://discourse.nodered.org/t/how-to-send-request-payload/60530/6 "2022-04-13T11:50:46Z")

</div>

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