SteMMo
SteMMo

Reputation: 418

Node-red: do not render the web page

My project needs to show some weather data in a web page.
I build the following schema: enter image description here

When I request the /gateway/pos URL a OpenWeatherMap request is done, and, if the returned code 'cod' is '200', i build a web page with some data.
In this way the browser show me the html code (as an text editor).
If I remove the 'http request', the page is rendered correctly.

Any idea?

Upvotes: 1

Views: 345

Answers (1)

knolleary
knolleary

Reputation: 10117

The message emitted by the http request node includes a property that contains the HTTP response headers. This is called msg.headers.

The http response node also uses this property to set the HTTP headers of the response to the original request. This is the cause of the unexpected behaviour.

You should add a change node and delete the msg.headers property after the http request node.

Upvotes: 2

Related Questions