mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-09 08:28:47 +00:00
HttpClient: Fix NullPointerException if response has no content type.
This commit is contained in:
parent
a873801249
commit
27bf5d6c1e
1 changed files with 1 additions and 1 deletions
|
@ -101,7 +101,7 @@ public final class HttpClient {
|
||||||
public Response intercept(final Interceptor.Chain chain) throws IOException {
|
public Response intercept(final Interceptor.Chain chain) throws IOException {
|
||||||
Response response = chain.proceed(chain.request());
|
Response response = chain.proceed(chain.request());
|
||||||
final MediaType originalContentType = response.body().contentType();
|
final MediaType originalContentType = response.body().contentType();
|
||||||
if ("text".equalsIgnoreCase(originalContentType.type())
|
if (originalContentType != null && "text".equalsIgnoreCase(originalContentType.type())
|
||||||
&& "xml".equalsIgnoreCase(originalContentType.subtype())
|
&& "xml".equalsIgnoreCase(originalContentType.subtype())
|
||||||
&& originalContentType.charset() == null) {
|
&& originalContentType.charset() == null) {
|
||||||
final String peek = response.peekBody(64).string();
|
final String peek = response.peekBody(64).string();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue