REST Client VS Code Extension POST with application/json doesn't recognize body

Viewed 1521

The title is pretty self explanatory. I'm using REST Client@0.23.2 by Huachao Mao (Visual Studio Code extension) and a POST request doesn't recognize the body I passed.

By the way, the backend is spring boot with OAuth2.

client.rest

###
POST http://localhost:8082/oauth/token HTTP/1.1
Content-Type: application/json
Authorization: Basic trusted:secret

{
    "grant_type": "password",
    "username": "admin",
    "password": "123456"
}

returns the following error. Which means it doesn't recognize the arguments I passed.

{
  "error": "invalid_request",
  "error_description": "Missing grant type"
}

Whereas the request below works fine.

###
POST http://localhost:8082/oauth/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Authorization: Basic trusted:secret

grant_type=password
&username=admin
&password=123456

What's wrong? I saw examples in their documentation but I kinda don't find the different between mine and theirs.

0 Answers
Related