This project demonstrates how to configure API Gateway using Claudia API Builder to support binary content handling. There are three endpoints:
/img
: shows how to receive a text request and respond with binary content/info
endpoint shows how to receive binary content and respond with text/thumb
: endpoint shows how to receive and respond with binary content
- run
npm install
to download the dependencies - run
npm run create
to deploy the project to Lambda. Grab the API ID from the result and replace<API-ID>
in the example commands below
curl https://<API-ID>.execute-api.us-east-1.amazonaws.com/latest/img -H "Accept: image/png" > 1.png
curl --request POST -H "Content-Type: image/png" --data-binary "@img.png" https://<API-ID>.execute-api.us-east-1.amazonaws.com/latest/info
curl --request POST -H "Content-Type: image/png" -H "Accept: image/png" --data-binary "@img.png" https://<API-ID>.execute-api.us-east-1.amazonaws.com/latest/thumb > thumb.png
Check out the Handling Binary Content Tutorial for more information on these features, and see the Binary Data Type support for API Gateway for more information on how things are configured under the hood.