postman returns 200 code and rest assured 404 with post method

1,169 views
Skip to first unread message

Susree Mohanty

unread,
Aug 29, 2018, 11:56:35 AM8/29/18
to REST assured
Hi All,
               I am been facing the issue not sure how to fix it.
The postman returns 200 code for post method.
however with rest assured it returns 404 not found error,
 String body = "{\n" +
" \"id\": \"4\",\n" +
" \"name\": \"danka\",\n" +
" \"adress\": {\n" +
" \"city\": \"Calcutta\",\n" +
" \"country\": \"India\"\n" +
" }\n" +
" }";

System.out.println(body);
given().contentType("application/json")
.body(body)
.when().post("http://127.0.0.1:8080/customers").then().log().all()
.statusCode(200);
get request is working fine.
can I anyone suggest some solution?

Johan Haleby

unread,
Aug 29, 2018, 2:06:31 PM8/29/18
to rest-a...@googlegroups.com
Hi,

Hmm you could try removing the charset, sometimes that could be a difference.

If not then I suggest you to use something like wireshark to investigate the difference on the wire level.

/Johan

--
You received this message because you are subscribed to the Google Groups "REST assured" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages