How to printout the URL that RestAssured trying to connect with to the web service?

user1459497 picture user1459497 · Feb 3, 2017 · Viewed 7.2k times · Source

This is very basic and simple question regarding Rest-assured framework. I have been trying to connect to weather webservice api using some param. But i kept getting connection refused. I could not find out what actually the URL that rest-assured trying to connect with.

given().
        param("APPID","xxxxxx").
        param("q","London").
    get(EndPoint.GET_ENDPOINT).
        then().
            statusCode(200).
                log().everything();

Getting this: java.net.ConnectException: Connection refused.

I would like to print out the connection URL in my console. Do you have any idea how?

Answer

Gergely A. picture Gergely A. · Feb 16, 2017

Move the .log().all() part to the `.given()̀ part, it should print it out to the console:

given().log().all()
  .param(…)…