@Test public void testSawErrorResponse() { HttpRequest req = new HttpRequest(Uri.parse("http://www")); HttpResponse ok = new HttpResponseBuilder().setHttpStatusCode(200).create(); HttpResponse redir = new HttpResponseBuilder().setHttpStatusCode(302).create(); HttpResponse notFound = new HttpResponseBuilder().setHttpStatusCode(404).create(); HttpResponse doh = new HttpResponseBuilder().setHttpStatusCode(502).create(); OAuthResponseParams params = new OAuthResponseParams(token, origRequest, crypter); assertFalse(params.sawErrorResponse()); params.addRequestTrace(req, ok); assertFalse(params.sawErrorResponse()); params.addRequestTrace(req, redir); assertFalse(params.sawErrorResponse()); params.addRequestTrace(req, null); assertTrue(params.sawErrorResponse()); params = new OAuthResponseParams(token, origRequest, crypter); params.addRequestTrace(req, notFound); assertTrue(params.sawErrorResponse()); params = new OAuthResponseParams(token, origRequest, crypter); params.addRequestTrace(req, doh); assertTrue(params.sawErrorResponse()); params.addRequestTrace(req, ok); assertTrue(params.sawErrorResponse()); }
@Test public void testSawErrorResponse() { HttpRequest req = new HttpRequest(Uri.parse("http://www")); HttpResponse ok = new HttpResponseBuilder().setHttpStatusCode(200).create(); HttpResponse redir = new HttpResponseBuilder().setHttpStatusCode(302).create(); HttpResponse notFound = new HttpResponseBuilder().setHttpStatusCode(404).create(); HttpResponse doh = new HttpResponseBuilder().setHttpStatusCode(502).create(); OAuthResponseParams params = new OAuthResponseParams(token, origRequest, crypter); assertFalse(params.sawErrorResponse()); params.addRequestTrace(req, ok); assertFalse(params.sawErrorResponse()); params.addRequestTrace(req, redir); assertFalse(params.sawErrorResponse()); params.addRequestTrace(req, null); assertTrue(params.sawErrorResponse()); params = new OAuthResponseParams(token, origRequest, crypter); params.addRequestTrace(req, notFound); assertTrue(params.sawErrorResponse()); params = new OAuthResponseParams(token, origRequest, crypter); params.addRequestTrace(req, doh); assertTrue(params.sawErrorResponse()); params.addRequestTrace(req, ok); assertTrue(params.sawErrorResponse()); }
@Test public void testSawErrorResponse() { HttpRequest req = new HttpRequest(Uri.parse("http://www")); HttpResponse ok = new HttpResponseBuilder().setHttpStatusCode(200).create(); HttpResponse redir = new HttpResponseBuilder().setHttpStatusCode(302).create(); HttpResponse notFound = new HttpResponseBuilder().setHttpStatusCode(404).create(); HttpResponse doh = new HttpResponseBuilder().setHttpStatusCode(502).create(); OAuthResponseParams params = new OAuthResponseParams(token, origRequest, crypter); assertFalse(params.sawErrorResponse()); params.addRequestTrace(req, ok); assertFalse(params.sawErrorResponse()); params.addRequestTrace(req, redir); assertFalse(params.sawErrorResponse()); params.addRequestTrace(req, null); assertTrue(params.sawErrorResponse()); params = new OAuthResponseParams(token, origRequest, crypter); params.addRequestTrace(req, notFound); assertTrue(params.sawErrorResponse()); params = new OAuthResponseParams(token, origRequest, crypter); params.addRequestTrace(req, doh); assertTrue(params.sawErrorResponse()); params.addRequestTrace(req, ok); assertTrue(params.sawErrorResponse()); }
responseParams.logDetailedWarning("OAuth fetch fatal error"); responseParams.setSendTraceToClient(true); } else if (responseParams.getAznUrl() != null && responseParams.sawErrorResponse()) { responseParams.logDetailedWarning("OAuth fetch error, reprompting for user approval"); responseParams.setSendTraceToClient(true);
} else if (responseParams.getAznUrl() != null && responseParams.sawErrorResponse()) { responseParams.logDetailedWarning(classname,"fetchNoThrow",MessageKeys.OAUTH_FETCH_ERROR_REPROMPT); responseParams.setSendTraceToClient(true);
responseParams.logDetailedWarning("OAuth fetch fatal error"); responseParams.setSendTraceToClient(true); } else if (responseParams.getAznUrl() != null && responseParams.sawErrorResponse()) { responseParams.logDetailedWarning("OAuth fetch error, reprompting for user approval"); responseParams.setSendTraceToClient(true);