I'm trying to Send a GET request to my api to obtain some result. i'm using x-www-form-urlencoded
. I successfully get the result using the following curl:
curl -k -X GET https://localhost:8443/parser -H 'accept: */*' -H "Content-Type: application/x-www-form-urlencoded" -d "mydata=1"
the '-k' is because I'm using https.
However, when I'm using the following swagger in Nodejs
* @swagger
* /parser:
* get:
* summary: Get scenario validation result.
* requestBody:
* content:
* application/x-www-form-urlencoded:
* schema:
* type: object
* properties:
* mydata:
* type: string
*
* responses:
* 200:
* description: success
*/
it returns an error TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body.
and the curl appeard as the follwoing :
curl -X 'GET' \
'https://localhost:8443/parser' \
-H 'accept: */*' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'mydata=8.1'
any hint?