package com.ssyf.feign.config;

import cn.dev33.satoken.same.SaSameUtil;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.context.annotation.Configuration;

/**
 * feign请求拦截处理
 * <p>对feign请求设置私有属性</p>
 * @author huwei 
 * @date 2023/2/24 10:10
 */
@Configuration
public class FeignConfiguration implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate requestTemplate) {

        //内部调用，同源认证处理
        requestTemplate.header(SaSameUtil.SAME_TOKEN, SaSameUtil.getToken());

//        requestTemplate.removeHeader("");
//        requestTemplate.header("1" ,"2");
    }
}
