@Test public void shouldReturnToOriginalResponseWhenNoneLocationIsDefined() throws URISyntaxException { URI origin = new URI("http: when(request.getURI()).thenReturn(origin); assertEquals( origin, response.getLocation() ); }
public URI getLocation() { try { String location = getHeaders().getFirst("Location"); if(location == null || location.equals("")) return getRequest().getURI(); else return new URI(location); } catch (URISyntaxException e) { throw new RestfulieException("Invalid URI received as a response", e); } }
ApacheResponse implements Response { public URI getLocation() { try { String location = getHeaders().getFirst("Location"); if(location == null || location.equals("")) return getRequest().getURI(); else return new URI(location); } catch (URISyntaxException e) { throw new RestfulieException("Invalid URI received as a response", e); } } }
ApacheResponse implements Response { public URI getLocation() { try { String location = getHeaders().getFirst("Location"); if(location == null || location.equals("")) return getRequest().getURI(); else return new URI(location); } catch (URISyntaxException e) { throw new RestfulieException("Invalid URI received as a response", e); } } ApacheResponse(HttpResponse response, RestClient client, Request details); }
ApacheResponse implements Response { public URI getLocation() { try { String location = getHeaders().getFirst("Location"); if(location == null || location.equals("")) return getRequest().getURI(); else return new URI(location); } catch (URISyntaxException e) { throw new RestfulieException("Invalid URI received as a response", e); } } ApacheResponse(HttpResponse response, RestClient client, Request details); int getCode(); String getContent(); List<String> getHeader(String key); T getResource(); String getType(); Headers getHeaders(); void discard(); URI getLocation(); Request getRequest(); String getStatusLine(); }
ApacheResponse implements Response { public URI getLocation() { try { String location = getHeaders().getFirst("Location"); if(location == null || location.equals("")) return getRequest().getURI(); else return new URI(location); } catch (URISyntaxException e) { throw new RestfulieException("Invalid URI received as a response", e); } } ApacheResponse(HttpResponse response, RestClient client, Request details); int getCode(); String getContent(); List<String> getHeader(String key); T getResource(); String getType(); Headers getHeaders(); void discard(); URI getLocation(); Request getRequest(); String getStatusLine();  }