在 drf-spectaulous swagger 中,post 方法有以下 3 种内容类型
application/json
application/x-www-form-urlencoded
multipart/form-data
Run Code Online (Sandbox Code Playgroud)
无论如何,是否可以将“ application/x-www-form-urlencoded ”作为我的帖子方法的默认内容类型。
@extend_schema(
description='API authentication using email & password',
# OpenApiRequestBody('content': "application/x-www-form-urlencoded")
)
Run Code Online (Sandbox Code Playgroud)
在extend_schema函数中,尝试将内容类型添加为form-urlencoded。但没有运气。
提前致谢
django content-type django-rest-framework x-www-form-urlencoded drf-spectacular