微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

哪个 OpenFeign 客户端标头有效?

如何解决哪个 OpenFeign 客户端标头有效?

在下面的代码中,唯一包含的头是 D.. 我想包含的标题是静态的,所以我宁愿使用其他方法之一!有什么想法吗?

import feign.Headers;
import feign.Response;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

@RefreshScope
@Headers("A: a")
public interface FeignClientX {

    @Headers("B: b")
    @RequestMapping(value = "/api/",method = RequestMethod.GET,headers = "C: c")
    Response getFee(@RequestHeader("D") String token);
}

日志:

 ---> GET https://localhost/api/stuff HTTP/1.1
[DEBUG] [2c98d243b8c7e7db,2c98d243b8c7e7db,false] 2021-01-07 17:08:24.938 [http-nio-80-exec-1] RavencoinFeeBackupClient - [FeignClientX#getFee] User-Agent: xxxxxxxx
[DEBUG] [2c98d243b8c7e7db,false] 2021-01-07 17:08:24.938 [http-nio-80-exec-1] RavencoinFeeBackupClient - [FeignClientX#getFee] ---> END HTTP (0-byte body)
[DEBUG] [2c98d243b8c7e7db,false] 2021-01-07 17:08:25.269 [http-nio-80-exec-1] RavencoinFeeBackupClient - [FeignClientX#getFee] <--- HTTP/1.1 200 OK (330ms)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。