refugeehackathon / refugeetransit-api

RESTful API for mobile and web clients
GNU Affero General Public License v3.0
1 stars 1 forks source link

Return correct content type #3

Closed johnjohndoe closed 9 years ago

johnjohndoe commented 9 years ago

The JSON response from the API does not return the correct content type:

Example:

$ curl -i https://migrationapi.tem.li/api/en/pois                    
HTTP/1.1 200 OK
Date: Mon, 26 Oct 2015 17:48:01 GMT
Server: Apache
Vary: Accept-Encoding
Strict-Transport-Security: max-age=15768000;includeSubdomains
X-Frame-Options: sameorigin
Transfer-Encoding: chunked
Content-Type: text/html;charset=UTF-8

It should be Content-Type: application/json;charset=utf-8 instead.

jelhan commented 9 years ago

Should set HTTP response header content type: http://docs.slimframework.com/response/headers/

There is also an alias method on Slim object, which isn't documented: $app->contentType('application/json'); https://github.com/slimphp/Slim/blob/faf83069298593bdfd8482a14bda171937473fc1/Slim/Slim.php#L1060-L1067

nebulak commented 9 years ago

I am going to fix it today afternoon. Thank you!

nebulak commented 9 years ago

Fixed. Please copy the new index.php to the server.

t2d commented 9 years ago

done

johnjohndoe commented 9 years ago

:+1: