February 2018
Intermediate to advanced
340 pages
9h 43m
English
The Client of the http package contains the CheckRedirect field. The field is a function that has the req and via parameters. req is the upcoming request and via refers to the previous requests. This way, you can modify the request after the redirect. In the previous example, the Known-redirects header is modified.
In case the CheckRedirect function returns the error, the last response with a closed body accompanied with a wrapped error is returned. In case the http.ErrUseLastResponse is returned, the last response is returned, but the body is not closed so it is possible to read it.
Read now
Unlock full access