Hey I need to access the "set-cookie" headers of a...
# suitescript
j
Hey I need to access the "set-cookie" headers of an http request, server side. I am using
<http://https.post|https.post>()
and then getting the
Set-Cookie
header from the response. The huge issue with this though is that it only contains the first
Set-Cookie
. How do I access the rest of the cookies that the server returned? I do not have control of the server.
"For legacy reasons". Come on NetSuite... the https modules is the most limited web request library I have ever had the displeasure of using and it's the only option in server suitescript afaik
b
whatever you are doing is unusual in general
Set-Cookie is for browsers and the server is not a browser
j
Need to web scrape data from a website that doesn't have an api, and to authenticate I need to act like a browser and retrieve/send it's cookies
c
You can’t really bash netsuite for this one
j
Netsuite also doesnt let you set the response code in suitelets/restlets, and doesnt let you post binary data for file uploads. But thats besides the point. Ill use an aws lambda function to transform the response and add the cookies to the body of the response.
s
Using a light external helper like that is generally the simplest answer to work around NS limitations.