vscode-restclient icon indicating copy to clipboard operation
vscode-restclient copied to clipboard

Common http header

Open fred214 opened this issue 4 years ago • 3 comments

The environmentVariables is quite useful that I can switch between different environment conveniently. But I have the same http headers cross different request, although I can put the these http header in the environmentVariables, but I still write key value in different request. Is there any approach that I can using one variable which contains the list of key values in different request?

fred214 avatar Oct 08 '21 07:10 fred214

Same situation here, I have quite a lot of request like this in the same file

GET {{url}}/c/contract
wb-key: {{api_key}}
Content-Type: application/json 

And I have to constantly repeat the headers

I'm not sure what would be the best approach, maybe some kind of settings that apply to the whole file, but it might be neccesary to have some way to remove those default for specific headers.

perhaps something like

@common-headers
wb-key: {{api_key}}
Content-Type: application/json 

###
GET {{url}}/c/contract
wb-key: {{api_key}}
Content-Type: text 

### headers could be overriden

###
POST {{url}}/c/authenticate
--wb-key: 
Content-Type: application/json 

(The -- means to remove the wb-key header for that particular request)

opensas avatar Mar 04 '22 22:03 opensas

was about to open a suggestion for this very same file based common header idea ! this would really be great, I have headers I want on every request for this particular file ... but not for other files so the setting approach is not ideal

aktxyz avatar Jul 03 '22 15:07 aktxyz

and also, I find it more explicit, easy to follow and better for using it as documentation to have everything on the same file

opensas avatar Jul 04 '22 14:07 opensas