Also response objects stored cookies in the respective cookies property that were sent in the Cookie request header instead of the Set-Cookie response headers.
Changes
Dependencies
replaced dependency cookie with set-cookie-parser as the former one is only for parsing Cookie headers, not Set-Cookie headers which are the only ones needing a parser in my proposal
let tests fail when the expected status code is not present using validateStatus in Axios request config
removed console.log in tests which cluttered test output
included HTTP response headers in tests
implemented cookie tests
Implementation
returnRequestObject(): Cookies now get a special treatment and are not just sent through transformObjectToArray() which was the root cause of the issue.
returnResponseObject():
Set-Cookie headers are now properly parsed and stored to the cookie property as requested by HTTP Archive format draft
a request-duration header originally was inserted by the lib which is undesired imho as it could cause downstream issues. Request duration is still included in the time property now.
getCookies() was removed as it is not needed any more in my proposal
Open questions
I also changed checkObj() to not JSON.stringify() arrays any more. I am not sure if this could break something so I'd love to hear opinions on this.
Hey there!
I found an issue with cookie handling so I attempted to fix it. My proposal came out larger than anticipated so let me explain.
Issue description
The resulting
.har
files included cookies like this:Also response objects stored cookies in the respective
cookies
property that were sent in theCookie
request header instead of theSet-Cookie
response headers.Changes
Dependencies
cookie
withset-cookie-parser
as the former one is only for parsingCookie
headers, notSet-Cookie
headers which are the only ones needing a parser in my proposalTests
express
ashttpstat.us
is unavailable more often than not (see https://github.com/aaronpowell/httpstatus/issues/135) and that blocked me writing test codevalidateStatus
in Axios request configconsole.log
in tests which cluttered test outputImplementation
returnRequestObject()
: Cookies now get a special treatment and are not just sent throughtransformObjectToArray()
which was the root cause of the issue.returnResponseObject()
:Set-Cookie
headers are now properly parsed and stored to thecookie
property as requested by HTTP Archive format draftrequest-duration
header originally was inserted by the lib which is undesired imho as it could cause downstream issues. Request duration is still included in thetime
property now.getCookies()
was removed as it is not needed any more in my proposalOpen questions
checkObj()
to notJSON.stringify()
arrays any more. I am not sure if this could break something so I'd love to hear opinions on this.Thanks for your work on this library!