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

[BUG]: Admin API do not obey content negotiation policy #45

Open
fogfish opened this issue Apr 19, 2019 · 1 comment
Open

[BUG]: Admin API do not obey content negotiation policy #45

fogfish opened this issue Apr 19, 2019 · 1 comment

Comments

@fogfish
Copy link
Contributor

fogfish commented Apr 19, 2019

API responses do not specify Content-Type

e.g.

curl -vvv localhost:4001/plugins/auth_key/issue_key -H 'Content-Type: application/json' -d '{"developer_id": "1dec6c98-4593-4e2f-8a19-8d84c84d9a19"}'

*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 4001 (#0)
> POST /plugins/auth_key/issue_key HTTP/1.1
> Host: localhost:4001
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 56
>
* upload completely sent off: 56 out of 56 bytes
< HTTP/1.1 201 Created
< server: Cowboy
< date: Fri, 19 Apr 2019 14:10:21 GMT
< content-length: 46
< cache-control: max-age=0, private, must-revalidate
<
* Connection #0 to host localhost left intact
{"key":"02ca521e-8bb3-486c-b8f2-54025022fcd6"}

Content-Type header is missing. HTTP Spec Says https://tools.ietf.org/html/rfc2616#section-7.2.1

Any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type header field defining the media type of that body.

See recommendations
https://www.programmableweb.com/news/rest-api-design-put-type-content-type/2011/11/18

@phanimahesh
Copy link
Member

Content negotiation I believe is out of scope for now, the plugin will only respond in json no matter what is requested. However, the missing header is an issue, we should add it. I'll add a quick fix in thr morning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants