我有一个Swagger Node应用程序,在swagger yaml中,我将路由器定义为示例
/test:
x-swagger-router-controller: test
post:
summary: Test
description: Test
operationId: Test
tags:
- Test
consumes:
- application/x-www-form-urlencoded
produces:
- application/json
parameters:
- name: testdata
in: formData
description: The string value of a token
required: true
type: string
curl -X POST \
http://localhost:5000/test \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'cache-control: no-cache' \
-d 'testdata=dasdasda&undefined='
curl -X POST \
http://localhost:5000/test \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache'
curl -X POST \
http://localhost:5000/test \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'cache-control: no-cache'
curl -X POST \
http://localhost:5000/test \
-H 'cache-control: no-cache'
能给我一个提示是什么问题
解决了添加新中间件的问题,并检查url是否为localhost:5000 / test来检查body是否为空,但我认为这是一种解决方法,不是最终解决方案