我尝试用二进制结果(gzip流)测试lambda函数。
我想使用sam local start-api
测试我的API。
该API返回如下二进制结果:
response.body = base64.b64encode("hello".encode('utf-8'))
#response.headers["Content-Encoding"] = "gzip"
response["isBase64Encoded"] = True
return response
浏览器看到的结果是base64编码(aGVsbG8=
),而不是二进制结果(hello
)。
可以在AWS控制台中激活binary support,但是如何激活二进制支持with sam local start-api
呢?