Commit 0527daa8 authored by Titouan Soulard's avatar Titouan Soulard

erp5_json_form: fix Content-Type and Cache-Control

parent 025baa4c
...@@ -103,29 +103,30 @@ class JSONForm(JSONType, TextDocument): ...@@ -103,29 +103,30 @@ class JSONForm(JSONType, TextDocument):
control.append("max-age=3600") control.append("max-age=3600")
control.append("private") control.append("private")
REQUEST.RESPONSE.setHeader("Cache-control", ", ".join(control)) REQUEST.RESPONSE.setHeader("Cache-control", ", ".join(control))
REQUEST.RESPONSE.setHeader("Content-Type", "application/json")
return json.dumps(schema, indent=2).encode() return json.dumps(schema, indent=2).encode()
security.declarePublic("getOutputJSONSchema") security.declarePublic("getOutputJSONSchema")
@UnrestrictedMethod @UnrestrictedMethod
def getOutputJSONSchema(self, REQUEST=None): def getOutputJSONSchema(self):
""" """
Method to retrieve the expected JSON Schema for JSON input Method to retrieve the expected JSON Schema for JSON input
""" """
return self.returnSchema( return self.returnSchema(
self.getOutputSchema(), self.getOutputSchema(),
"/getOutputJSONSchema", "/getOutputJSONSchema",
REQUEST self.REQUEST
) )
security.declarePublic("getInputJSONSchema") security.declarePublic("getInputJSONSchema")
@UnrestrictedMethod @UnrestrictedMethod
def getInputJSONSchema(self, REQUEST=None): def getInputJSONSchema(self):
""" """
Method to retrieve the expected JSON Schema for JSON output Method to retrieve the expected JSON Schema for JSON output
""" """
return self.returnSchema( return self.returnSchema(
self.getTextContent(), self.getTextContent(),
"/getInputJSONSchema", "/getInputJSONSchema",
REQUEST self.REQUEST
) )
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment