Vscode-restclient: Header name must be a valid HTTP token ["{"]

Created on 6 Oct 2019  路  11Comments  路  Source: Huachao/vscode-restclient

I had a previous simple test file that was working
I tried to add a couple of requests in the same file
but now I just get the error above on any request...

I tried reverting any changes to the .http file
but still the extension just gives this invalid error each time i try to load a resource.

  • VSCode Version: Version: 1.38.1

  • OS Version: OSX 10.14.6

  • REST Client Version: 0.22.2

Steps to Reproduce:

  1. make a file with some simple tests like
POST http://localhost:55200/test HTTP/1.1
content-type: application/json
{
    "cname": "weile"
}

all will work fine. wait a while. do something?
then error occurs:

  1. try and run click 'send request'

error message pops up as toast.

Most helpful comment

OK looks like the error is:

POST http://localhost:55200/test HTTP/1.1
content-type: application/json
{
    "cname": "weile"
}

where as this is OK:

POST http://localhost:55200/test HTTP/1.1
content-type: application/json

{
    "cname": "weile"
}

All 11 comments

OK looks like the error is:

POST http://localhost:55200/test HTTP/1.1
content-type: application/json
{
    "cname": "weile"
}

where as this is OK:

POST http://localhost:55200/test HTTP/1.1
content-type: application/json

{
    "cname": "weile"
}

so the extra line is critical. a bit of a pedantic bug...

@dcsan this follows the rules in RFC, and there should be a separated blank line between header and body parts.

Error text about the blank line in message box should be clear.

Exactly @viT-1 - The error is so vague, took me lot of time to find this out - Just a simple notification error would help many users;

Just so that a newbee gets it,

GET http://localhost:3099/subscribers GET http://localhost:3099/subscribers
while following code will not
`GET http://localhost:3099/subscribers

GET http://localhost:3099/subscribers`

i dont understand well how to fix this error

For Postman -
Under Headers section click for hidden(headers). And remove duplicate headers(key-values).
that's it..!!!
try again to call API(or run collection).

i dont understand well how to fix this error

@AleksandrIvanov9655 Leave an empty line between your request headers and request body

i can solve it by manually retyping the command :)

This is closed, but I am bumping this because the error message should be clear, because currently it's not, I had to search here to figure it out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jianwu picture jianwu  路  13Comments

symbioticKid picture symbioticKid  路  28Comments

ryan-ju picture ryan-ju  路  17Comments

lldata picture lldata  路  13Comments

mtxr picture mtxr  路  13Comments