[英]Swagger UI 3.19.4 (Swagger 2.0) query parameter select
I have Swagger UI 3.19.4
and I want to create REST
requests like following: 我有
Swagger UI 3.19.4
,我想创建REST
请求,如下所示:
GET https://<host>/<path>?select=*
It means that I want to add query parameter select=*
in each get request that will be sent from Swagger UI
. 这意味着我想在将从
Swagger UI
发送的每个get请求中添加查询参数select=*
。
How can I do that? 我怎样才能做到这一点?
My solution is to use requestInterceptor
我的解决方案是使用
requestInterceptor
SwaggerUiBundle({
...,
requestInterceptor: (request) => {
uri = new URI(request.uri);
uri.selectParams.append("select", "*");
request.uri = uri.toString();
//code
return request;
}
})
I decided to use requestInterceptor, because it is official way to modify requests from SwaggerUI https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/ . 我决定使用requestInterceptor,因为这是修改SwaggerUI https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/的请求的官方方法。 Also to modify URL you can use standard class URL (JavaScript).
您也可以使用标准类URL(JavaScript)来修改URL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.