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
HTTP method is overridden #12
Comments
Well, that scenario could happen when you define a client level HTTP method. I've fixed the issue. Try updating go get -u gopkg.in/h2non/gentleman.v0 |
Hum. It doesn't seems to solve the problem for me. I don't define a client level HTTP method. I only do: type Repository struct {
c *gentleman.Client
}
func NewRepository() *Repository {
return &Repository{c: gentleman.New()}
} And then call the |
Have you tried it again updating gentleman?. It should work now since the method is define either in client or request level via middleware call chain. |
Yeah the update is done. // Method defines the HTTP verb to be used.
func (r *Request) Method(method string) *Request {
r.Middleware.UseRequest(func(ctx *context.Context, h context.Handler) {
ctx.Request.Method = method
fmt.Print(ctx.Request.Method)
h.Next(ctx)
})
return r
} Prints |
I see where is the issue. You're always calling |
Oh ok ! Perfect, thanks a lot. |
I wanted to try gentleman doing a simple:
But when I use it, the HTTP method is overridden and the client always send a
POST
.When I write
fmt.Printf(req.Context.Request.Method)
just before theSend
and it prints aGET
, I can see that afmt.Printf(ctx.Request.Method)
in thedoDial
method of the dispatcher prints aPOST
.Am I doing something wrong ?
The text was updated successfully, but these errors were encountered: