Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to use TestRestTemplate with spring-data-rest #2365

Open
DanKaplanSES opened this issue Feb 14, 2024 · 0 comments
Open

Document how to use TestRestTemplate with spring-data-rest #2365

DanKaplanSES opened this issue Feb 14, 2024 · 0 comments
Assignees
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@DanKaplanSES
Copy link

DanKaplanSES commented Feb 14, 2024

TestRestTemplate is relatively popular in the spring world but it's not obvious how to use it with the spring-data-rest CrudRepository generated endpoints. spring-data-rest wraps every response in an object I didn't create. It's not obvious how to use TestRestTemplate with this object unless I return simple response classes like String or Map<?, ?>.

    • If TestRestTemplate can be used with spring-data-rest, please provide examples of using it with response bodies more complex than String or Map<?, ?>. e.g., a Person class.
    • Please also include a postForEntity and/or putForEntity(putForEntity doesn't exist) example, because I see a lot of people struggling to make requests that send a complex class, e.g., Person, in the request body.
    • If TestRestTemplate is the wrong tool for the job, please recommend the right tool or a better tool. This might already be documented, but I've been unable to find it.

Thanks,
Dan

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

3 participants