How to send request payload?

How to send request payload?


and request header
image

I trying like this


[{"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


How to decode?

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

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

1 Like

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.

1 Like

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

1 Like

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