swagger 动态设置版本号_在swagger UI中发送动态自定义标头试用

I am using swagger in java.

I am reading a header called callerId through requestAttributes in the code. I am not using the header through the annotation @HeaderParam.

because of this reason, the header section is not showing up in the swagger UI for try outs.

How can I make this header show up in the try out form.

Is there any way I can achieve this without hard coding the header value.

Thanks in advance.

解决方案

You can add parameters to an operation using @ApiImplicitParams and @ApiImplicitParam.

The following wiki documentation should provide you with an explanation on how to use these annotations - https://github.com/swagger-api/swagger-core/wiki/Annotations#apiimplicitparam-apiimplicitparams

Keep in mind I assume here that this is not a security header but actually part of the API (at least based on the description you gave). If you're looking for a security header, there's an alternative method. Please leave a comment and I'll edit this response.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值