Closed
Description
Given the following object:
headers = {
"Access-Control-Allow-Headers": "*",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET,POST,DELETE"
}
And the following server function:
@server.route("/api/v1/info", HTTPMethod.GET)
def info(request):
"""Return info"""
try:
obj = {"version": Api.api_version, "name": Api.api_name}
response = json.dumps(obj)
return HTTPResponse(status=CommonHTTPStatus.OK_200, body=response, content_type=MIMEType.TYPE_JSON, headers=Api.headers)
except:
return HTTPResponse(status=CommonHTTPStatus.BAD_REQUEST_400, headers=Api.headers)
The content-type gets turned to octet-stream and the content-length gets set to 1024.
doing this in the response.py code in the _construct_response_bytes function works fine:
headers.setdefault("Access-Control-Allow-Headers", "*")
headers.setdefault("Access-Control-Allow-Origin", "*")
headers.setdefault("Access-Control-Allow-Methods", "*")
this is a temporary solution, but not very preferred. I have looked around in the code and I have no idea what causes this issue
Metadata
Metadata
Assignees
Labels
No labels