下面是一个 API *.yml 部分。我想将数据的响应标头设置为Content-type: text/plain
,但它application/json
现在总是返回。
/order:
post:
tags:
- order
summary: order
operationId: PostOrder
parameters:
requestBody:
description: Order result
content:
application/json:
schema:
type: object
properties:
openReq:
type: string
example: 'test'
responses:
200:
description: Customer order receive successed
headers: {}
content:
application/json:
schema:
type: string
text/plain:
schema:
type: string
此 python 代码返回响应:
def post_order(platform, open_req=None): # noqa: E501
"""order
"""
return 'do some magic!'
响应头总是content-type: application/json
responses:
200:
description: Customer order receive successed
headers: {}
content:
application/json:
schema:
type: string
text/plain:
schema:
type: string
此代码段的响应标头始终为content-type: text/plain; charset=utf-8
responses:
200:
description: Customer order receive successed
headers: {}
content:
# application/json:
# schema:
# type: string
text/plain:
schema:
type: string
我可以在函数中设置响应头内容类型post_order
吗?