lundi 15 avril 2019

Restassured test error - No Content-Type was specified in response

I try to test my rest endpoint with restassured. The response is always a html document, altough i set the accept-header to "application/json".

*java.lang.IllegalStateException: Cannot parse object because no supported Content-Type was specified in response. Content-Type was 'text/html;charset=utf-8'.

[main] DEBUG org.apache.http.wire - << "HTTP Status 400 [0xe2][0x80][0x93] Bad Request*

myClass result = given()
                    .contentType("application/json")
                    .accept("application/json")
                    .header("sessionid", sessionId)
                    .body(myBody)
                    .when()
                    .post(getInternalEndpoint() + "/rest/v1/myEndpoint").as(myClass.class);

Aucun commentaire:

Enregistrer un commentaire