-
-
Notifications
You must be signed in to change notification settings - Fork 371
Description
Describe the bug
When using the Retrieve a Collection API endpoint as documented here I notice that when sending a request with the Accept header correctly set to application/json the server was incorrectly returning Content-Type:text/html.
Upon looking at the source code I can see this bug is seemingly due to the following line: https://github.com/writeas/writefreely/blob/master/collections.go#L321
Steps to reproduce (if necessary)
Steps to reproduce the behavior:
- Request the GET
/api/collections/{COLLECTION_ALIAS}API endpoint withAcceptheader set forapplication/json - Server responds with HTML.
Expected behavior
The request is stating it accepts json the server should respond with content type json or HTTP 415 Unsupported Media Type if not supported. Given that the API supports returning JSON it should have responded with JSON.
The following line https://github.com/writeas/writefreely/blob/master/collections.go#L321 potentially needs amending to include the Accept header as well.