Skip to content
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

can't set http header or send request body #257

Open
zhqqqy opened this issue Feb 4, 2021 · 1 comment
Open

can't set http header or send request body #257

zhqqqy opened this issue Feb 4, 2021 · 1 comment

Comments

@zhqqqy
Copy link

zhqqqy commented Feb 4, 2021

If I do the following then the query body can't send successful.

   request := gorequest.New()
   request.Post("http://address").
       Send(`{"query":{"match_phrase":{"age":"327"}}}`).
       Set("Content-Type", "application/x-www-form-urlencoded").End()

but if I do the following then the http header can't set successful.

    request := gorequest.New()
    request.Set("Content-Type", "application/x-www-form-urlencoded").
        Post("http://address").
        Send(`{"query":{"match_phrase":{"age":"327"}}}`).End()
@lethe3000
Copy link

See #76
you should call request.Post first or set flag SetDoNotClearSuperAgent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants