We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package main import ( "errors" "github.com/go-resty/resty/v2" ) func main() { client := resty.New() client.OnBeforeResponse(func(client *resty.Client, response *resty.Response) error { if response.Size() > 1073741824 { return errors.New("file is too big") } return nil }).R().SetOutput("/path/123.zip").Get("http://www.ooxx.com/123.zip") }
I want to determine the size of the content before parsing the Response, and throw an error if it exceeds my preset size.
The text was updated successfully, but these errors were encountered:
package main import ( "errors" "github.com/go-resty/resty/v2" ) func main() { client := resty.New() client.OnBeforeResponse(func(client *resty.Client, response *resty.Response) error { if response.Size() > 1073741824 { return errors.New("file is too big") } return nil }).R().SetOutput("/path/123.zip").Get("http://www.ooxx.com/123.zip") } I want to determine the size of the content before parsing the Response, and throw an error if it exceeds my preset size.
This can help you https://github.com/gospider007/requests/blob/master/test/middleware/requestCallback_test.go
Sorry, something went wrong.
No branches or pull requests
I want to determine the size of the content before parsing the Response, and throw an error if it exceeds my preset size.
The text was updated successfully, but these errors were encountered: