Skip to main content
Participant
January 31, 2017
Question

Net.HTTP response headers are missing cookies

  • January 31, 2017
  • 0 replies
  • 359 views

My response function is being called from a Net.HTTP PUT call; however, the response header array only contains the headers I set for the request, eg. Content-Type, and does not contain any of the response headers, eg. Set-Cookie.

oHandler:

{

     response: function(oRequest, cURL, oException, aRspHeaders) {

          if (oException != undefined) {

               app.alert("Unknown exception occurred: "+ oException.msg);

          } else {

               if (aRspHeaders.length > 0) {

                    var headerstr = '';

                    for (var i=0; i<aRspHeaders.length; i++) {

                         headerstr += aRspHeaders.name + '=' + aRspHeaders.value + '\n';

                    }

                    app.alert("Headers\n" + headerstr);

               }

          }

     }

}

Here's the cURL trace:

> POST /login HTTP/1.1

> Host: api.abc.net

> User-Agent: curl/7.50.3

> Accept: */*

> Content-Type: application/x-www-form-urlencoded

> Content-Length: 42

>

* upload completely sent off: 42 out of 42 bytes

< HTTP/1.1 204

< Cache-Control: no-cache, no-store, max-age=0, must-revalidate

< Cache-control: no-cache="set-cookie"

< Date: Tue, 31 Jan 2017 17:25:17 GMT

< Expires: 0

< Pragma: no-cache

< Server: nginx/1.10.1

< Set-Cookie: JSESSIONID=ABC0389D6CAD42596FB88EF02148A993;path=/;Secure;HttpOnly

< Strict-Transport-Security: max-age=31536000 ; includeSubDomains

< X-Content-Type-Options: nosniff

< X-Frame-Options: DENY

< X-XSS-Protection: 1; mode=block

< Connection: keep-alive