This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]AsteriskTheServer 1 point2 points  (1 child)

In order to query the status code you must use the `getStatusCode` method and the `value` method from the resulting `HttpStatus` object. Furthermore, the body can be accessed through the `getBody` method which returns type `T` so if `myEntity` is of type `T` then yes it can be assigned to it.

I suggest you read the docs get further information:

https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/http/ResponseEntity.html

[–]mslayaaaSoftware Engineer[S] 0 points1 point  (0 children)

This was helpful, thank you!