Answer the question
In order to leave comments, you need to log in
How to get all Cookies after a GET request?
I open the site page in chrome, I immediately look at the cookies in the developer tools (Network -> Cookies):
Of those on the screen, I can only get JSESSIONID
.
Further on Network -> Headers for the same request:
1) What put down all these headings? After all, as I understand it, they were put BEFORE the request, and not after, if not, then why are they in Request Headers ?
Accordingly, I get only Response Headers in the script, which is logical in principle, but then it's not clear where the rest of the cookies are?
Cookies to output stream:
class Main {
static void main(String[] args) {
URL myUrl = new URL("https://example.ru/index.html")
URLConnection urlConn = myUrl.openConnection()
urlConn.connect()
def temp = null
for (int i = 1; urlConn.getHeaderFieldKey(i) != null; i++) {
println("${urlConn.getHeaderFieldKey(i)} : ${urlConn.getHeaderField(i)}")
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question