У меня странная проблема с RestAssured, потому что я не вижу ни одного поля.
почему я использую почтальон для отправки запроса
Код: Выделить всё
curl --location 'http://localhost:8080/team/testing-endpoint'
Код: Выделить всё
{ "timestamp": "2024-03-09T18:24:10.622+00:00", "status": 404, "error": "Not Found", "message": "UserName: userNameToDeletedoes not belong to team: teamName", "path": "/team/testing-endpoint" }
Код: Выделить всё
given() .get("team/testing-endpoint") .then().extract().response().asString();
Код: Выделить всё
{"timestamp":"2024-03-09T18:40:10.295+00:00","status":404,"error":"Not Found","path":"/team/testing-endpoint"}
For Testing Purpose I just created simple endpoint:
Код: Выделить всё
@GetMapping("testing-endpoint")
public ResponseEntity testingEndpoint() {
String userNameToDelete = "userNameToDelete";
String teamName = "teamName";
throw new ResponseStatusException(HttpStatus.NOT_FOUND,
"UserName: " + userNameToDelete + "does not belong to teammmmm: " + teamName);
}
I looked through google but with no answer.
I want to get access to "message" field by using RestAssured response
Источник: https://stackoverflow.com/questions/781 ... m-response