vscode-restclient
vscode-restclient copied to clipboard
incorrect header check
- REST Client Version: v0.24.6
- VSCode Version: 1.65.0-insider
- OS Version: Mac OS 12.1
Steps to Reproduce:
- call to api of playfab
eg: POST https://TitleId.playfabapi.com/Client/RegisterPlayFabUser
Content-Type: application/json
{
"TitleId": "{{TitleId}}",
"Username": "uu1",
"Email": "[email protected]",
"Password": "password"
}
I also tried with postman, curl and node-fetch its work well.
curl -X POST https://<TitleId>.playfabapi.com/Client/RegisterPlayFabUser -H 'content-type:application/json' -d '{"TitleId":"<TitleId>","Username":"uu1","Email":"[email protected]","Password":"<password>"}'
this is log from vscode-rest
[Error - 10:22:09 AM] Failed to send request:
ReadError: incorrect header check
at EventEmitter.<anonymous> (/Users/xxx/.vscode-insiders/extensions/humao.rest-client-0.24.6/dist/extension.js:558:34006)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Might have something to do with the fact that the server in question uses HTTP/2 but by default restclient expects HTTP/1.1
I can see in the verbose response of curl (with -vv
) that the server is HTTP/2 but the example doesn't seem to specify the protocol version in the request
Many thank @andrei-dascalu for response. I've tried with HTTP/2 as below but that error still there
POST {{gameApi}}/Client/LoginWithEmailAddress HTTP/2
Content-Type: application/json
{
"TitleId": "{{titleId}}",
"Email": "<email>",
"Password": "<password>"
}
This is my code snippet to send request, is it correct?
I was able to work around this issue by adding the Accept-Encoding: gzip
header to my request. It looks like by default PlayFab uses the "deflate" content encoding and something about that doesn't play nicely with REST Client. The issue is not limited to PlayFab either. For instance, this request fails in REST Client with the same error:
GET https://example.com/comments/1
Accept-Encoding: deflate