@Override public String reason() { return this.response.reason(); } @Override
@Override public final String reason() { return this.response.reason(); }
/** * Fetch response from server. * @param stream The content to send. * @return The obtained response * @throws IOException If an IO exception occurs. */ private Response fetchResponse(final InputStream stream) throws IOException { final long start = System.currentTimeMillis(); final Response response = this.wire.send( this, this.home, this.mtd, this.hdrs, stream, this.connect, this.read ); final URI uri = URI.create(this.home); Logger.info( this, "#fetch(%s %s%s %s): [%d %s] in %[ms]s", this.mtd, uri.getHost(), // @checkstyle AvoidInlineConditionalsCheck (1 line) uri.getPort() > 0 ? String.format(":%d", uri.getPort()) : "", uri.getPath(), response.status(), response.reason(), System.currentTimeMillis() - start ); return response; }
final JsonObjectBuilder json = Json.createObjectBuilder(); json.add("status", response.status()); json.add("reason", response.reason()); final JsonObjectBuilder headers = Json.createObjectBuilder(); for (final Map.Entry<String, List<String>> pair
int actualStatusCode = response.status(); try { Assert.assertEquals("Unexpected REST response status code. Status message: " + response.reason(), restTest.getExpectedStatusCode(), actualStatusCode); } catch (Error e) {
), rsp.status(), rsp.reason() );
), rsp.status(), rsp.reason() );
@Override public ValidationResponse validate(final String html) throws IOException { final Request req = this.request(html); final Response response = req.fetch(); if (response.status() != HttpURLConnection.HTTP_OK) { throw new IOException( response.reason() ); } return this.build( response.as(XmlResponse.class) .registerNs("nu", "http://n.validator.nu/messages/") .assertXPath("//nu:messages") .assertXPath("//nu:source") .xml() ); }