Guaranteed retention requests do not work

I am using Rest-Assured to test my Rest API. webservice is working fine as it works

    curl -u "admin:admin" http://localhost:8888/users/

I get my users as json.

then when trying a simple request with Rest-Assured

 RestAssured.authentication = basic("admin", "admin");

  expect().statusCode(200).when().get("http://localhost:8888/users/");

gives me a way out

    Exception in thread "main" org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:8888 refused
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:158)

what could it be?

+5
source share
1 answer

solved. Changed from localhostto 127.0.0.1, and it worked. It is strange that both cURL / browsers worked with localhost. Guess this could be a routing problem.

+2
source

All Articles