Vscode-restclient: Add support for default headers

Created on 3 May 2018  路  1Comment  路  Source: Huachao/vscode-restclient

  • VSCode Version: 1.22.2
  • OS Version: macOS High Sierra 10.13.4
  • REST Client Version: 0.18.3

Please add rest-client.defaultHost, rest-client.defaultContentType, rest-client.defaultAccept, etc.; so that, if configured, we don't have to specify http://localhost:8080/ or Host: localhost:8080.

The idea is that for things like:

PUT /documents/john
Host: localhost:8080
Content-Type: application/json
Accept: application/json; indent=4

{
    "firstname": "John",
    "lastName": "Smith"
}

One could simply configure the (workspace) settings:

{
    "rest-client.defaultHost": "localhost:8080",
    "rest-client.defaultContentType": "application/json",
    "rest-client.defaultAccept": "application/json; indent=4"
}

and use:

PUT /documents/john

{
    "firstname": "John",
    "lastName": "Smith"
}

The proposal is to convert settings of the form PascalCase to dash-separated (defaultHeaderName to header-name); so this would effectively extend rest-client.defaultuseragent (and rename it to rest-client.defaultUserAgent).

Edit:
I'd propose support for the following standard headers:

  • Accept
  • Accept-Charset
  • Accept-Datetime
  • Accept-Encoding
  • Accept-Language
  • Access-Control-Request-Headers
  • Access-Control-Request-Method
  • Authorization
  • Cache-Control
  • Content-Type
  • Cookie
  • Host
  • Origin
  • User-Agent
enhancement

Most helpful comment

@Kronuz I have added some comment in #206, and what about

{
    "rest-client.defaultHeaders": {
         "X-Custom-Header": "foo bar",
         "Host": "localhost"
    }
}

>All comments

@Kronuz I have added some comment in #206, and what about

{
    "rest-client.defaultHeaders": {
         "X-Custom-Header": "foo bar",
         "Host": "localhost"
    }
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

akalcik picture akalcik  路  15Comments

symbioticKid picture symbioticKid  路  28Comments

chewlm86 picture chewlm86  路  13Comments

mtxr picture mtxr  路  13Comments

akalcik picture akalcik  路  16Comments