From 6c2de40dba21d0f08b6745b455502bd273275b8b Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 5 Jun 2017 11:33:24 +0100 Subject: [PATCH] Add cookie handling to HTTP Request node --- nodes/core/io/21-httprequest.html | 9 ++++++++ nodes/core/io/21-httprequest.js | 37 +++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 47 insertions(+) diff --git a/nodes/core/io/21-httprequest.html b/nodes/core/io/21-httprequest.html index bd157a9ff..7beffe261 100644 --- a/nodes/core/io/21-httprequest.html +++ b/nodes/core/io/21-httprequest.html @@ -81,6 +81,8 @@ Must be one of GET, PUT, POST, PATCH or DELETE.
headers object
Sets the HTTP headers of the request.
+
cookies object
+
If set, can be used to send cookies with the request.
payload
Sent as the body of the request.
@@ -97,6 +99,8 @@
responseUrl string
In case any redirects occurred while processing the request, this property is the final redirected url. Otherwise, the url of the original request.
+
responseCookies object
+
If the response includes cookies, this propery is an object of name/value pairs for each cookie.

Details

When configured within the node, the URL property can contain mustache-style tags. These allow the @@ -104,6 +108,11 @@ example.com/{{{topic}}}, it will have the value of msg.topic automatically inserted. Using {{{...}}} prevents mustache from escaping characters like / & etc.

Note: If running behind a proxy, the standard http_proxy=... environment variable should be set and Node-RED restarted.

+

Cookie handling

+

The cookies property passed to the node must be an object of name/value pairs. + The value can be either a string to set the value of the cookie or it can be an + object with a single value property.

+

Any cookies returned by the request are passed back under the responseCookies property.