Skip to content

Commit 953100a

Browse files
author
Noor Dawod
committed
Show response content type which is not allowed.
Plus, keep 4-spaces indentation correct.
1 parent f32c234 commit 953100a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

library/src/main/java/com/loopj/android/http/BinaryHttpResponseHandler.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ public final void sendResponseMessage(HttpResponse response) throws IOException
105105
if (contentTypeHeaders.length != 1) {
106106
//malformed/ambiguous HTTP Header, ABORT!
107107
sendFailureMessage(
108+
status.getStatusCode(),
109+
response.getAllHeaders(),
110+
null,
111+
new HttpResponseException(
108112
status.getStatusCode(),
109-
response.getAllHeaders(),
110-
null,
111-
new HttpResponseException(
112-
status.getStatusCode(),
113-
"None, or more than one, Content-Type Header found!"
114-
)
113+
"None, or more than one, Content-Type Header found!"
114+
)
115115
);
116116
return;
117117
}
@@ -129,13 +129,13 @@ public final void sendResponseMessage(HttpResponse response) throws IOException
129129
if (!foundAllowedContentType) {
130130
//Content-Type not in allowed list, ABORT!
131131
sendFailureMessage(
132+
status.getStatusCode(),
133+
response.getAllHeaders(),
134+
null,
135+
new HttpResponseException(
132136
status.getStatusCode(),
133-
response.getAllHeaders(),
134-
null,
135-
new HttpResponseException(
136-
status.getStatusCode(),
137-
"Content-Type not allowed!"
138-
)
137+
"Content-Type (" + contentTypeHeader.getValue() + ") not allowed!"
138+
)
139139
);
140140
return;
141141
}

0 commit comments

Comments
 (0)