user1459497 user1459497 - 4 years ago 196
Java Question

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

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 Source

RestAssured stores all the pieces of the URL it will construct as static variables.

System.out.println(RestAssured.baseURI + ":" + RestAssured.port + RestAssured.basePath + EndPoint.GET_ENDPOINT);

I don't know of a method that will combine them already, though I think it would be a reasonable feature request for a static method, or possibly on RequestSpecification.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download