From 639d1ae5c0a2c1cc0b6f731f291d7b95024f644e Mon Sep 17 00:00:00 2001 From: Jonathon McMurray Date: Wed, 25 Aug 2021 16:36:10 +0100 Subject: [PATCH] Allow adding of cookies if reQ is loaded --- ws-client/ws.q | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ws-client/ws.q b/ws-client/ws.q index c2526e0..67e90a1 100644 --- a/ws-client/ws.q +++ b/ws-client/ws.q @@ -35,6 +35,7 @@ if[not `req in key `; $[count q`body;q`body;""]; //add payload if present :r; //return complete query string }; + .cookies.addcookies:{[q]q}; // without reQ loaded, don't do anything with cookies ]; VERBOSE:@[value;`.ws.VERBOSE;$[count .z.x;"-verbose" in .z.x;0b]]; //default to non-verbose output @@ -48,6 +49,7 @@ open0:{[x;y;v] q:.req.proxy q; //handle proxy if needed hs:.url.hsurl`$raze q ./:enlist[`url`protocol],$[`proxy in key q;1#`proxy;enlist`url`host]; //get hostname as handle q[`headers]:(enlist"Origin")!enlist q[`url;`host]; //use Origin header + q:.cookies.addcookies[q]; //if reQ is loaded, cookies can be added s:first r:hs d:.req.buildquery[q]; //build query & send if[v;-1"-- REQUEST --\n",string[hs]," ",d]; //if verbose, log request if[v;-1"-- RESPONSE --\n",last r]; //if verbose, log response