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

[rest] Allow binary MediaType for RawType item states #2825

Merged
merged 1 commit into from
Mar 13, 2022

Conversation

J-N-K
Copy link
Member

@J-N-K J-N-K commented Mar 8, 2022

Closes #1581

This PR adds the ability to use different media types for RawType states. If the Accept header does not specify text/plain (which is the default used before), a new method checks if any of the provided media types in the header matches the media type of the state and sends the response with that media-type set. If no match is found, but the Accept header specifies application/octet-stream this media type is used. In case of media-type mismatch status 415 (unsupported media type) is returned. If the item state is not RawType the request is considered invalid and a 400 (bad request) is returned.

Signed-off-by: Jan N. Klug github@klug.nrw

Signed-off-by: Jan N. Klug <github@klug.nrw>
@J-N-K J-N-K requested a review from a team as a code owner March 8, 2022 19:17
@wborn wborn added the enhancement An enhancement or new feature of the Core label Mar 9, 2022
Copy link
Member

@wborn wborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks.

@wborn wborn merged commit ea68ae0 into openhab:main Mar 13, 2022
@wborn wborn added this to the 3.3 milestone Mar 13, 2022
@wborn wborn added the REST/SSE label Mar 13, 2022
@J-N-K J-N-K deleted the feature-mediatypeforrawtype branch March 13, 2022 15:28
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/openhab-3-3-release-discussion/136925/10

@spacemanspiff2007
Copy link
Contributor

Is there any documentation what file types are supported (e.g. in the swagger) or is the information only available in the source code?

splatch pushed a commit to ConnectorIO/copybara-hab-core that referenced this pull request Jul 12, 2023
Signed-off-by: Jan N. Klug <github@klug.nrw>
GitOrigin-RevId: ea68ae0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature of the Core REST/SSE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

REST API: /items/{itemName}/state returns RawTypes as encoded plain text
4 participants