toedter / hal-explorer

An API explorer for RESTful Hypermedia APIs using HAL or HAL-FORMS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Most links are not showing up with Spring Boot 2.5.0

eiswind opened this issue · comments

Bildschirmfoto von 2021-05-21 13-29-49

I created a simple example with an Entity and a JpaRepository. This works fine in Spring Boot 2.4.6 but does not show POST/DELETE etc links in 2.5.0.

Not sure, this could be also a data-rest issue :)

@eiswind
The content-type in your response header is application/prs.hal-forms+json.
In this case only GET request is displayed in HAL Explorer.

In case you planned to make a HAL-FORMS example, this seems intended behaviour.
For a HAL example content-type should be application/hal+json.

Best
Patrick

@pmoule, you are right. This is on purpose with HAl-FORMS media type, since HAL-FORMS provides affordances (_templates) for exactly those use cases. If you want to provide create or delete functionality, you would define the respective affordances.
BTW, the media type for HAL is application/hal+json

@eiswind, when you are using String HATEOAS you can choose from a list of supported media types. Spring Data REST only supported HAL in the past but they are also moving to HAL-FORMS.

Thanks for clearing this up! I didn't catch that change.

This must be a new behaviour of data-rest then. I just updated the spring boot version an got this new content-type w/o further changes. I'll have to investigate a little further.

Thanks for pointing this out, I will check with latest Spring Data REST versions soon.

@toedter

BTW, the media type for HAL is application/hal+json

thx, fixed the typo

@eiswind

This must be a new behaviour of data-rest then. I just updated the spring boot version an got this new content-type w/o further changes. I'll have to investigate a little further.

Did you find out how to suppress HAL-FORMS support in Spring Data REST or Spring HATEOAS for HAL Explorer to continue working for all HTTP Methods as it was working with previous versions of SpringBoot (2.4.9 earlier)?

@pravinkalekar just set the content-type header to application/hal+json in the ui.

@eiswind

@pravinkalekar just set the content-type header to application/hal+json in the ui.

I still don't understand how to suppress hal-forms. I couldn't find the location to set the content-type header in the Spring Boot HAL explorer ui. Could you explain with more details to control it?

@djkeh
Use the "Edit Headers" button in the top left corner next to the API URL to set the content-type header.

@pravinkalekar Wow. I couldn't see that button. Thanks!

For those who want more accurate information, in order to get application/hal+json content-type response, I can set my request header using Accept key.

image
image

Tested on Spring Boot 2.5.4