awslabs / aws-lambda-go-api-proxy

lambda-go-api-proxy makes it easy to port APIs written with Go frameworks such as Gin (https://gin-gonic.github.io/gin/ ) to AWS Lambda and Amazon API Gateway.
Apache License 2.0
1.05k stars 197 forks source link

ProxyResponseWriter.Write is a little too "naive" #14

Closed raff closed 6 years ago

raff commented 6 years ago

This implementation seems to imply the handler will do only one Write to complete the request, that is not true (or not documented anywhere):

func (r *ProxyResponseWriter) Write(body []byte) (int, error) {
    r.body = body
        ...

Maybe changing ProxyResponseWriter.body to a bytes.Buffer would be a better implementation.