File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
src/AndroidClient/client/src/test/java/net/servicestack/client/tests Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,44 @@ public void exec(HttpURLConnection res, Exception ex) {
155155 assertNotNull (status .getStackTrace ());
156156 }
157157
158+ public void test_Does_handle_401_Error_with_empty_ResponseBody () {
159+ JsonServiceClient testClient = new JsonServiceClient ("http://test.servicestack.net" );
160+
161+ final Exception [] globalError = new Exception [1 ]; //Wow Java, you suck.
162+ final Exception [] localError = new Exception [1 ];
163+ WebServiceException thrownError = null ;
164+
165+ JsonServiceClient .GlobalExceptionFilter = new ExceptionFilter () {
166+ @ Override
167+ public void exec (HttpURLConnection res , Exception ex ) {
168+ globalError [0 ] = ex ;
169+ }
170+ };
171+
172+ testClient .ExceptionFilter = new ExceptionFilter () {
173+ @ Override
174+ public void exec (HttpURLConnection res , Exception ex ) {
175+ localError [0 ] = ex ;
176+ }
177+ };
178+
179+ TestAuth request = new TestAuth ();
180+
181+ try {
182+ TestAuthResponse response = testClient .put (request );
183+ }
184+ catch (WebServiceException webEx ){
185+ thrownError = webEx ;
186+ }
187+
188+ assertNotNull (globalError [0 ]);
189+ assertNotNull (localError [0 ]);
190+ assertNotNull (thrownError );
191+
192+ ResponseStatus status = thrownError .getResponseStatus ();
193+ assertNull (status );
194+ }
195+
158196 public void test_Does_handle_ValidationException (){
159197 ThrowValidation request = new ThrowValidation ()
160198 .setEmail ("invalidemail" );
You can’t perform that action at this time.
0 commit comments