New issue
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
Multiple PreRequestHooks #665
Comments
@rostislaved It was intentionally kept as one prehook. However, I'm planning to make much improvement in v3. |
The vernacular should change from func Compose(hooks ...PreRequestHook) PreRequestHook {
var errors []error
return func(c *Client, r *http.Request) error {
for _, hook := range hooks {
errors := append(errors,hook(c,r))
}
return fmt.ErrorF("%v",errors)
}
} |
@chb0github There is an upcoming redesign in the middleware chain on request and response on v3.0.0. Current v2 series, I'm planning to keep it as-is. |
Looking forward to it |
I face the same problem as in #517 (comment) - I couldn't get not nil raw request.
The only way to get raw request is to use PreRequestHook. But we can have only one hook which will we overwritten if we try to attach the second one like this:
But having several hooks can be handy. I personally use it to:
That is why I wrote function which acts like this:
So I want so propose to make it possible to have multiple PreRequestHook objects. That will allow to use resty this way:
The text was updated successfully, but these errors were encountered: