Huachao / vscode-restclient

REST Client Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=humao.rest-client
MIT License
5.32k stars 445 forks source link

Payload not sent (Content-Type: application/x-www-form-urlencoded) #897

Open arnoe opened 3 years ago

arnoe commented 3 years ago

Steps to Reproduce:

  1. Sending the request to the server.

request.http:

@clientId = XXXXX
@clientSecret = XXXXX
### Get Token
POST https://www.someapi.com/oauth2/token
Accept: application/json
Content-Type: application/x-www-form-urlencoded

client_secret={{clientSecret}}&client_id={{clientId}}&grant_type=client_credentials
  1. The response from the server shows that payload has not been provided.
  2. I now take the same request and send it via curl as follows.

terminal:

curl -X POST \
  https://www.someapi.com/oauth2/token \
  -H 'accept: application/json' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -d 'client_id=XXXXX&client_secret=XXXXXX&grant_type=client_credentials'
  1. Response from server is successful.
Huachao commented 3 years ago

@arnoe I can't repro the issue, could you please show me a screenshot of your request?

DieterHolvoet commented 2 years ago

I'm having a similar issue. The payload is sent, but the clientId and clientSecret variables are not substituted. Maybe this is the same issue.

request.http

POST https://{{host}}/oauth/token
Accept: application/json
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&client_id={{clientId}}&client_secret={{clientSecret}}

> {% client.global.set('accessToken', response.body.access_token); %}

Actual request

CleanShot 2022-03-14 at 11 48 29