File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
src/AndroidClient/android/src/androidTest/java/net/servicestack/android/test Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff 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" );
You can’t perform that action at this time.
0 commit comments