Question:
I have a lambda function that returns a string that contains UTF-8 characters (german umlaute). However, The AWS API-Gateway response does not contain the utf-8 header. How can I add it so the client receives a readable response?
Answer:
I was able to solve this problem like this in Python:
1 2 3 4 5 6 7 |
return { 'statusCode': 200, 'headers': { "content-type":"application/json; charset=utf-8"}, 'body': json.dumps(data) } |
I just needed to set the additional header “content-type”.
But I’m not sure whether you need to have “HTTP-Proxy-Integration” enabled (like i did).