package com.tzy.common.utils.http.forest.interceptor;

import com.dtflys.forest.http.ForestRequest;
import com.dtflys.forest.interceptor.Interceptor;
import org.apache.poi.ss.formula.functions.T;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author by po'yi
 * @Classname MyTestInterceptor
 * @Description TODO
 * @Date 2021/12/1 16:47
 */
public class MyTestInterceptor implements Interceptor<T> {
	private final static Logger log = LoggerFactory.getLogger(Interceptor.class);

	/**
	 * 该方法在请求发送之前被调用, 若返回false则不会继续发送请求
	 * @Param request Forest请求对象
	 */
	@Override
	public boolean beforeExecute(ForestRequest req) {
		log.info("invoke beforeExecute");
		// 执行在发送请求之前处理的代码
		req.addHeader("X-Version","1.6.38");
		req.addHeader("openid","");
		req.addHeader("Content-Type","application/json;charset=UTF-8");
		req.addHeader("Authorization","Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxNTciLCJ1bmlvbmlkIjoiIiwidHlwZSI6IlRISVJEX0FQSyIsImV4cCI6MTY0NTA4NjYxMiwiaWF0IjoxNjQyNDk0NjEyLCJ1c2VybmFtZSI6IjEzMDcxMDA1MTAzIn0.021jYZ07_F5bc2g9JOFP_tq68EcEBmMFLIX5f09dczwp_2klWKll8oJnFysJlWMf5sh0LaHCEOtFBWVCSPAG8g");
		return true;
	}
}
