Closed git-hulk closed 3 years ago
Can you please clarify your question. It does work even when HTTP response with an error. Below you can find part of my code:
// After REST response is received
// Checking for REST error response.
// https://github.com/go-resty/resty/blob/master/client.go#L382
tb.resty.OnAfterResponse(func(_ *resty.Client, r *resty.Response) error {
if r.IsError() {
// TODO: Analyze refreshToken method
if r.StatusCode() == 401 {
Ok, you might be talking about this issue: https://github.com/go-resty/resty/issues/356
I will check that on my side as well.
hi, @felixd,
thanks for your reply, sorry that I didn't explain the question clearly. My question was thatOnAfterResponse
hook wasn't invoked when occurs the error like network/DNS failure, since the resty would return the error before invoking the hook in below:
https://github.com/go-resty/resty/blob/master/client.go#L837 https://github.com/go-resty/resty/blob/master/client.go#L860
Can you please clarify your question. It does work even when HTTP response with an error. Below you can find part of my code:
// After REST response is received // Checking for REST error response. // https://github.com/go-resty/resty/blob/master/client.go#L382 tb.resty.OnAfterResponse(func(_ *resty.Client, r *resty.Response) error { if r.IsError() { // TODO: Analyze refreshToken method if r.StatusCode() == 401 {
Ok, you might be talking about this issue: #356
I will check that on my side as well.
yeah, close this issue as a duplicate
hey,
OnAfterResponse
middleware only applied when the HTTP response without error, does it make sense that also applies it on error?