All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.ishow.starter.rpc.basic.HeaderInterceptor Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
package cn.ishow.starter.rpc.basic;

import cn.ishow.starter.common.context.App;
import cn.ishow.starter.common.util.spring.WebUtils;
import feign.RequestInterceptor;
import feign.RequestTemplate;

/**
 * 特定请求头设置器
 *
 * @author bucheng
 * @create 2022/6/20 21:17
 * @description
 */
public class HeaderInterceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate template) {
        template.header("X-Upstream-Service", App.getServiceName());
        template.header("userId", WebUtils.getHeader("userId"));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy