次のようなクライアントを使用して、Netflix Feignを使用してJava httpクライアントを作成しています。
public interface PromocodeClient {
@Headers({
"Content-Type:" + MediaType.APPLICATION_JSON_UTF8_VALUE, "userIdentifier: {userIdentifier}"
})
@RequestLine("POST /rootpath/{code}/unblock")
Boolean unblock(
@Param("userIdentifier") String userIdentifier,
@Param("code") String promocode,
BookingDTO booking);
static PromocodeClient connect() {
return Feign.builder()
.encoder(new GsonEncoder())
.decoder(new GsonDecoder())
.target(PromocodeClient.class, Urls.SERVICE_URL.toString());
//Url.SERVICE_URL = http://localhost:8082/1.0
}
奇妙なエラーが表示されます
{
"timestamp" : "2016-08-02T07:47:16.208+0000",
"status" : 415,
"error" : "Unsupported Media Type",
"exception" : "org.springframework.web.HttpMediaTypeNotSupportedException",
"message" : "Content type 'pplication/json;charset=UTF-8' not supported",
"path" : "/1.0/rootpath/COD_PROMOCODE/unblock"
}
}
メッセージには「コンテンツ タイプ 'アプリケーション/json;charset=UTF-8' はサポートされていません」というメッセージが表示されますMediaType.APPLICATION_JSON_UTF8_VALUE
が、Spring の値を使用しています。
アプリケーション/json;文字セット=UTF-8
誰が何が起こっているのか知っていますか?