# HTTP request in node-Red

**URL:** <https://discourse.nodered.org/t/http-request-in-node-red/17749>\
**Category:** General\
**Created:** [10 November 2019 15:39 UTC](https://discourse.nodered.org/t/http-request-in-node-red/17749 "2019-11-10T15:39:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![osstynd](https://avatars.discourse-cdn.com/v4/letter/o/e47c2d/32.png) [@osstynd](https://discourse.nodered.org/u/osstynd)\
**Post date:** [10 November 2019 15:39 UTC](https://discourse.nodered.org/t/http-request-in-node-red/17749/1 "2019-11-10T15:39:24Z")

</div>

Hi,

I am having a very simple issue.  
I am trying to check upon the status of my Daikin Aircon.  
When I enter the following in a Chrome web browser:  
**10.10.10.50/aircon/get\_sensor\_info**  
I get following response:  
**ret=OK,htemp=23.0,hhum=35,otemp=10.0,err=0,cmpfreq=0**

I analysed the webpage and following is what happens:  
General

- Request URL: [http://10.10.10.50/aircon/get\_sensor\_info](http://10.10.10.50/aircon/get_sensor_info)
- Request Method: GET
- Status Code: 200 OK
- Remote Address: 10.10.10.50:80
- Referrer Policy: no-referrer-when-downgrade

Response Headers

- HTTP/1.0 200 OK
- Content-Length: 52
- Content-Type: text/plain

Request Headers  
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,_/_;q=0.8,application/signed-exchange;v=b3

- Accept-Encoding: gzip, deflate
- Accept-Language: en,nl;q=0.9,nl-NL;q=0.8,en-US;q=0.7
- Cache-Control: max-age=0
- Connection: keep-alive
- Host: 10.10.10.50
- Upgrade-Insecure-Requests: 1
- User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36

When I try the same in GET mode with NodeRed and HTTP request node I only receive an empty string:  
msg.payload: string[0]  
" "  
when I try "the" example, simply replacing the URL with [https://nodered.org](https://nodered.org) I get a perfect outcome.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [10 November 2019 15:49 UTC](https://discourse.nodered.org/t/http-request-in-node-red/17749/2 "2019-11-10T15:49:15Z")

</div>

can you try with `curl` or `wget` ?  
maybe you need to add `msg.headers` object to match those sent by the browser ?

---

<div class="post-metadata">

**Author:** ![osstynd](https://avatars.discourse-cdn.com/v4/letter/o/e47c2d/32.png) [@osstynd](https://discourse.nodered.org/u/osstynd)\
**Post date:** [10 November 2019 16:16 UTC](https://discourse.nodered.org/t/http-request-in-node-red/17749/3 "2019-11-10T16:16:10Z")

</div>

I thought it would be simple, but apparently it isn't.  
I can use curl or wget if that would solve the issue, but first I would need to study how it works for sure 😉

---

<div class="post-metadata">

**Author:** ![osstynd](https://avatars.discourse-cdn.com/v4/letter/o/e47c2d/32.png) [@osstynd](https://discourse.nodered.org/u/osstynd)\
**Post date:** [10 November 2019 16:25 UTC](https://discourse.nodered.org/t/http-request-in-node-red/17749/4 "2019-11-10T16:25:00Z")

</div>

I tried wget on the console, and it is returning (downloading) the outcome.  
When I do the same in NodeRed (using an exec node), I get the same effect: a download.  
So that seems to work, but I can't capture the outcome that way of course.

---

<div class="post-metadata">

**Author:** ![osstynd](https://avatars.discourse-cdn.com/v4/letter/o/e47c2d/32.png) [@osstynd](https://discourse.nodered.org/u/osstynd)\
**Post date:** [10 November 2019 16:27 UTC](https://discourse.nodered.org/t/http-request-in-node-red/17749/5 "2019-11-10T16:27:10Z")

</div>

Alright... curl is also a system command... so in the exec node I entered te curl and now I have a payload. Thanks!

---

<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:** [10 November 2019 16:48 UTC](https://discourse.nodered.org/t/http-request-in-node-red/17749/6 "2019-11-10T16:48:27Z")

</div>

I think @dceejay was trying to determine if it worked with curl, you can inspect the headers.

Note that you should set the debug node to "complete msg object" as the headers are not in the payload.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [10 November 2019 17:33 UTC](https://discourse.nodered.org/t/http-request-in-node-red/17749/7 "2019-11-10T17:33:46Z")

</div>

Hi Dirk,  
Some time ago I have developed the [node-red-contrib-http-logger](https://github.com/bartbutenaers/node-red-contrib-http-logger) node to see what is being send (e.g. by the http-request node). So then you can compare it with the request that your browser sends (which you can see in the 'Network' tabsheet of your browser's developer tools).  
But curl could indeed be sufficient.  
Bart
