use of com.canoo.dp.impl.platform.core.http.HttpHeaderConstants.ACCEPT_CHARSET_HEADER in project dolphin-platform by canoo.
the class HttpCallResponseBuilderImpl method readString.
@Override
public Promise<HttpResponse<String>, HttpException> readString() {
connection.addRequestHeader(new HttpHeaderImpl(ACCEPT_CHARSET_HEADER, CHARSET));
final ResponseContentConverter<String> converter = b -> new String(b, CHARSET);
return createExecutor(converter);
}
use of com.canoo.dp.impl.platform.core.http.HttpHeaderConstants.ACCEPT_CHARSET_HEADER in project dolphin-platform by canoo.
the class HttpCallResponseBuilderImpl method readObject.
@Override
public <R> Promise<HttpResponse<R>, HttpException> readObject(final Class<R> responseType) {
Assert.requireNonNull(responseType, "responseType");
connection.addRequestHeader(new HttpHeaderImpl(ACCEPT_CHARSET_HEADER, CHARSET));
connection.addRequestHeader(new HttpHeaderImpl(ACCEPT_HEADER, JSON_MIME_TYPE));
final ResponseContentConverter<R> converter = b -> gson.fromJson(new String(b, CHARSET), responseType);
return createExecutor(converter);
}
Aggregations