What steps will reproduce the problem?
Run a test that looks like:
@Test
public void staticBaseUriNotTakenIntoAccount() {
RestAssured.requestSpecification = new RequestSpecBuilder().build();
RestAssured.baseURI = "http://code.google.com/";
RestAssured.given()
.log().all()
.when()
.get("/p/rest-assured")
.then()
.log().all()
.statusCode(200);
}
What is the expected output? What do you see instead?
I expect the request to be a GET on http://code.google.com/p/rest-assured.
Instead, I see a logged request on http://localhost:8080/p/rest-assured. It
looks like this:
Request method: GET
Request path: http://localhost:8080/p/rest-assured
Proxy: <none>
Request params: <none>
Query params: <none>
Form params: <none>
Path params: <none>
Multiparts: <none>
Headers: Accept=*/*
Cookies: <none>
Body: <none>
The rest of the log is:
15:17:15.053 [main] DEBUG o.a.h.i.c.BasicClientConnectionManager - Get connection for route {}->http://localhost:8080
15:17:15.067 [main] DEBUG o.a.h.i.c.DefaultClientConnectionOperator - Connecting to localhost:8080
15:17:16.067 [main] DEBUG o.a.h.i.c.DefaultClientConnectionOperator - Connect to localhost:8080 timed out. Connection will be retried using another IP address
15:17:16.067 [main] DEBUG o.a.h.i.c.DefaultClientConnectionOperator - Connecting to localhost:8080
15:17:17.068 [main] DEBUG o.a.h.i.conn.DefaultClientConnection - Connection org.apache.http.impl.conn.DefaultClientConnection@cdc3aae closed
15:17:17.068 [main] DEBUG o.a.h.i.conn.DefaultClientConnection - Connection org.apache.http.impl.conn.DefaultClientConnection@cdc3aae shut down
15:17:17.068 [main] DEBUG o.a.h.i.c.BasicClientConnectionManager - Releasing connection org.apache.http.impl.conn.ManagedClientConnectionImpl@7ef2d7a6
What version of the product are you using? On what operating system?
I am using v2.4.0, on Windows 8.1
Note: alternatively, if I set RestAssured.baseURI BEFORE setting
RestAssured.requestSpecification, the request hits the right endpoint (GET
http://code.google.com/p/rest-assured/)
Note: another workaround, and possibly a cleaner way to do it, is to NOT use
the static RestAssured.baseUri field at all but use the baseUri() method on the
RequestSpecification class instead.
Original issue reported on code.google.com by gabriel....@gmail.com on 18 Nov 2014 at 8:30
Original issue reported on code.google.com by
gabriel....@gmail.com
on 18 Nov 2014 at 8:30