vaimee / zion

A scalable Thing Description Directory
Apache License 2.0
17 stars 4 forks source link

PATCH /things endpoint returns 400 no matter the payload #9

Closed ivanzy closed 2 years ago

ivanzy commented 2 years ago

I created a very simple TD and tried to updated it using the PATCH endpoint, but no matter the payload that I added in the PATCH request the server replied was { "type": "/errors/types/bad-request", "title": "Bad Request", "status": 400 }

For reference, the created TD was { "@context": "https://www.w3.org/2019/wot/td/v1", "title": "testTD", "securityDefinitions": { "basic_sc": { "scheme": "basic", "in": "header" } }, "security": "basic_sc" } and the executed PATCH request was curl --request PATCH \ --url http://localhost:3000/things/urn:uuid:1459b300-5388-4dcc-a802-90ebbf1e7e6e \ --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjksImlhdCI6MTY1OTEwNDM4MywiZXhwIjoxNjU5MTA1MjgzfQ.S7x7_ACToNa_caVE11asTts4xjgwZoQbMupI93FeUrI' \ --header 'content-type: application/json' \ --data '{"@context": "https://www.w3.org/2019/wot/td/v1","title": "update testTD","securityDefinitions": {"basic_sc": {"scheme": "basic","in": "header"}},"security": "basic_sc"}'

relu91 commented 2 years ago

The specs says to use application/merge-patch+json as content type. Any other type of content type results in a Bad Request. Therefore, this is the correct behavior. Please check the latest version and re-open if you are still experiences issues