Skip to content

Commit 9f64439

Browse files
committed
Merge branch 'master' of github.com:ServiceStack/ServiceStack.Java
2 parents 5a91feb + 0ca8e76 commit 9f64439

File tree

5 files changed

+608
-325
lines changed

5 files changed

+608
-325
lines changed

src/AndroidClient/android/src/androidTest/java/net/servicestack/android/test/TestServiceTests.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,44 @@ public void exec(HttpURLConnection res, Exception ex) {
168168
assertNotNull(status.getStackTrace());
169169
}
170170

171+
public void test_Does_handle_401_Error_with_empty_ResponseBody() {
172+
JsonServiceClient testClient = new JsonServiceClient("http://test.servicestack.net");
173+
174+
final Exception[] globalError = new Exception[1]; //Wow Java, you suck.
175+
final Exception[] localError = new Exception[1];
176+
WebServiceException thrownError = null;
177+
178+
JsonServiceClient.GlobalExceptionFilter = new ExceptionFilter() {
179+
@Override
180+
public void exec(HttpURLConnection res, Exception ex) {
181+
globalError[0] = ex;
182+
}
183+
};
184+
185+
testClient.ExceptionFilter = new ExceptionFilter() {
186+
@Override
187+
public void exec(HttpURLConnection res, Exception ex) {
188+
localError[0] = ex;
189+
}
190+
};
191+
192+
TestAuth request = new TestAuth();
193+
194+
try {
195+
TestAuthResponse response = testClient.send(request);
196+
}
197+
catch (WebServiceException webEx){
198+
thrownError = webEx;
199+
}
200+
201+
assertNotNull(globalError[0]);
202+
assertNotNull(localError[0]);
203+
assertNotNull(thrownError);
204+
205+
ResponseStatus status = thrownError.getResponseStatus();
206+
assertNull(status);
207+
}
208+
171209
public void test_Does_handle_ValidationException(){
172210
ThrowValidation request = new ThrowValidation()
173211
.setEmail("invalidemail");

0 commit comments

Comments
 (0)