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?
I was able to solve this problem like this in Python:
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With