lifadev / archive_aws-lambda-go-shim

Author your AWS Lambda functions in Go, effectively.
https://github.com/eawsy/aws-lambda-go-shim
Apache License 2.0
789 stars 66 forks source link

How to access req/resp? #52

Closed keynan closed 6 years ago

keynan commented 6 years ago

In the event I'd like to return something sensible instead of JSON. Like an HTML/UI, or a fast marshal/unmarshal format such as PROTOBUF.

fsenart commented 6 years ago

Hi @keynan,

AWS Lambda waits for a JSON response. So you cannot return other stuff. For your use case, one immediate solution may be to embed your response into a simple JSON serializable object:

map[string]interface{}{
  "HTML": `
    <body>
    </body>
  `,
}