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

Unset header #15

Closed
JulioJu opened this issue May 24, 2019 · 2 comments
Closed

Unset header #15

JulioJu opened this issue May 24, 2019 · 2 comments

Comments

@JulioJu
Copy link

JulioJu commented May 24, 2019

Hi !

Maybe it could be cool to unset header like curl done.

Test: test

GET http://www.google.fr

# On the following request, we don't want the header field `Test: test` defined on the first line
# In curl, declare an header field empty don't add the header

Test:


GET http://www.google.com

See also #13 (comment) . As I said in this comment curl http://google.com appends some headers automatically like Accept: */*. To remove it simply use
curl http://google.com -H 'Accept. In Wireshark we see that the header Accept is not append.

Have the feature to have Global definition and local definition of headers could also be a solution https://github.com/diepm/vim-rest-console#52-global-definitions

@sharat87
Copy link
Owner

sharat87 commented Jun 5, 2019

Removing headers by not giving a value to the right of a header name is already a feature of Roast. However, looks like it stopped working some time ago and I never realized it. I fixed it now and also added a test so it doesn't come back.

I personally don't like the idea of separate global and local header definitions. It's confusing as when we look at a header line we can't immediately tell whether it will apply to a request or not. In the same vein, appending some headers automatically also doesn't seem like a good idea. We can always add the headers we want always in a few lines at the top of the roast file and that will keep the details of the requests explicit.

When I use roast, I test out a API call and see how it behaves and then translate that request into code to make that request. If roast did some hidden shenanigans that are not visible to me, I'll miss doing those shenanigans in my application code. That will result in a lot of hair pulled apart.

Thank you for all your issues and suggestions, but sorry to be turning them down. Please don't let me discourage you. Your inputs are always welcome :).

@sharat87 sharat87 closed this as completed Jun 5, 2019
@JulioJu
Copy link
Author

JulioJu commented Jun 23, 2019

So cool :-)

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