If I query the webservice with format=json, I expect the response to be in application/json. It is in text/plain. Could it be corrected?
Latest piwigo, php 5.6.40.
If I query the webservice with format=json, I expect the response to be in application/json. It is in text/plain. Could it be corrected?
Latest piwigo, php 5.6.40.
<!-- github-sync-id:512309831 -->
In fact, most answers are in JSON format but the server returns plain text messages when it encounters errors, which is problematic for third party apps.
In fact, most answers are in JSON format but the server returns plain text messages when it encounters errors, which is problematic for third party apps.
<!-- github-comment-id:546590870 -->
I have looked into this in detail and you are perfectly right. Answers are provided in JSON format (except when the server encounters an error) but the header of all answers contains a content type = text/plain instead of application/json. The content type should be application/json as described by RFC4627.
I have looked into this in detail and you are perfectly right. Answers are provided in JSON format (except when the server encounters an error) but the header of all answers contains a content type = `text/plain` instead of `application/json`. The content type should be `application/json` as described by [RFC4627](https://www.ietf.org/rfc/rfc4627.txt).
<!-- github-comment-id:547553723 -->
I have replaced text/plain with application/json in the file /include/ws_protocols/json_encoder.php and everything works fine with the iOS app awaiting for JSON data. However, web browsers have issues and loading the tools/ws.htm page returns an 'error when parsing JSON string'. So some work needs to be done to fix this issue before switching to 'application/json'.
I have replaced `text/plain` with `application/json` in the file `/include/ws_protocols/json_encoder.php` and everything works fine with the iOS app awaiting for JSON data. However, web browsers have issues and loading the `tools/ws.htm` page returns an 'error when parsing JSON string'. So some work needs to be done to fix this issue before switching to 'application/json'.
<!-- github-comment-id:547567677 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
If I query the webservice with format=json, I expect the response to be in application/json. It is in text/plain. Could it be corrected?
Latest piwigo, php 5.6.40.
In fact, most answers are in JSON format but the server returns plain text messages when it encounters errors, which is problematic for third party apps.
I have looked into this in detail and you are perfectly right. Answers are provided in JSON format (except when the server encounters an error) but the header of all answers contains a content type =
text/plaininstead ofapplication/json. The content type should beapplication/jsonas described by RFC4627.I have replaced
text/plainwithapplication/jsonin the file/include/ws_protocols/json_encoder.phpand everything works fine with the iOS app awaiting for JSON data. However, web browsers have issues and loading thetools/ws.htmpage returns an 'error when parsing JSON string'. So some work needs to be done to fix this issue before switching to 'application/json'.