fcl-web: TCustomJSONRPCModule Response content type
Original Reporter info from Mantis: Simon Ameis @SAmeis
-
Reporter name: Simon Ameis
Original Reporter info from Mantis: Simon Ameis @SAmeis
- Reporter name: Simon Ameis
Description:
TCustomJSONRPCModule doesn't set a content type in HTTP response object. This should be set to application/json indicate the JSON response should not be executed by the client webbrowser.
See https://stackoverflow.com/questions/477816/what-is-the-correct-json-content-type for reference
For fixing add &LtPos;code>AResponse.ContentType := 'application/json; charset=utf-8';&LtPos;/code> to &LtPos;em>TCustomJSONRPCModule.HandleRequest&LtPos;/em>. The &LtPos;em>charset=utf8&LtPos;/em> may be omitted, as UTF-8 is default encoding for JSON.
Also it would be reasonable to add a new property to TCustomJSONRPCModule in case the content type should be modified by user (e.g. to set application/javascript, see also link above).
Steps to reproduce:
When using fcl-web as FastCGI behind nginx, nginx will add text/html content type by itself when it's missing.
Mantis conversion info:
- Mantis ID: 35990
- OS: Windows 7, 64 bit
- OS Build: 6.1 SP 1
- Build: trunk
- Platform: Desktop PC
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 42768 (#a7f363e2).
- Target version: 3.2.0