go-resty / resty

Simple HTTP and REST client library for Go
MIT License
9.98k stars 706 forks source link

How to modify response body OnAfterResponse? #802

Open panyox opened 3 months ago

panyox commented 3 months ago
rc := resty.New()
rc.OnAfterResponse(func(c *resty.Client, r *resty.Response) error {
        // eg: in here, i want to modify response body
                 if r.StatusCode() == 403 {
                     // how can i change body to other content
                 }
        return nil
    })