I have a UI Automation script, written in JavaScript. From that script, how do I execute a GET request to a URL with a cookie? E.g:
curl "https://example.com/path?a=123&b=cool" --cookie "c=12"
Or, if you know how to run system commands from JavaScript, like you can do in Ruby, that’ll work too.
After checking out HTTP GET request in JavaScript? and reading step 7 of “3.6.2. The setRequestHeader() method” in the W3C specs for XMLHttpRequest, I came up with:
FYI, I’m disregarding the response because I’m deleting a resource (perhaps I should verify the correct response so that I know the resource was deleted). So, yes, this should be a DELETE request, but they configured the server to accept a GET request, and I have no control over this.