feignclient设置头信息

1,498 阅读1分钟

@FeignClient(name = "testclient", url = "${feign.url.httpToTest}", fallback = TestFallback.class)

public interface TestClient {

@RequestMapping(value = "/test/get", method = RequestMethod.POST,consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)

Map<String, Object> test(@RequestParam("source") String source,@RequestParam("type") String type);

}

TraceFeignClient:89 - The modified request equals POST http://127.0.0.1:8080/test/get?source=test&type=1 HTTP/1.1

X-Access-Source: INNER

X-Span-Name: http:/violate_token/v1/get

Accept: application/json;charset=UTF-8

X-B3-SpanId: 48d666cf8c39e387

X-B3-Sampled: 0

X-B3-TraceId: 48d666cf8c39e387

Content-Type: application/x-www-form-urlencoded

说明: Content-Type:是接口提供方的接收方式,通过consumes来配置,默认是Form表单提交(application/x-www-form-urlencoded) Accept: 是接口调用方接收返回结果的方式,通过produces来设置

www.cnblogs.com/huahua035/p…