Skip to content

Commit

Permalink
fix lambda response header
Browse files Browse the repository at this point in the history
  • Loading branch information
EndoNrak committed Oct 9, 2023
1 parent 25d200a commit 21cc29b
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def evaluation(event: dict, context):
"statusCode": 200,
"headers": {
"Content-Type": "image/jpeg",
'Access-Control-Allow-Origin': FRONTEND_ORIGIN,
'Access-Control-Allow-Methods': 'OPTIONS,POST',
},
"isBase64Encoded": True,
"body": base64.b64encode(open('/tmp/canvas.jpg', 'rb').read()).decode('utf-8')
Expand All @@ -44,6 +46,8 @@ def evaluation(event: dict, context):
"body": "Time expired error",
"headers": {
"Content-Type": "text/plain",
'Access-Control-Allow-Origin': FRONTEND_ORIGIN,
'Access-Control-Allow-Methods': 'OPTIONS,POST',
},
}
except subprocess.CalledProcessError as e:
Expand All @@ -52,6 +56,8 @@ def evaluation(event: dict, context):
"body": f"Runtime error\n{e.stderr.decode('utf-8')}",
"headers": {
"Content-Type": "text/plain",
'Access-Control-Allow-Origin': FRONTEND_ORIGIN,
'Access-Control-Allow-Methods': 'OPTIONS,POST',
},
}

Expand Down

0 comments on commit 21cc29b

Please sign in to comment.