You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Request the GET /api/collections/{COLLECTION_ALIAS} API endpoint with Accept header set for application/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.
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 toapplication/json
the server was incorrectly returningContent-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:
/api/collections/{COLLECTION_ALIAS}
API endpoint withAccept
header set forapplication/json
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.
The text was updated successfully, but these errors were encountered: