Skip to content

Commit

Permalink
sladg#56 Allow an API route to return binary data by not hardcoding t…
Browse files Browse the repository at this point in the history
…he response as non-binary.
  • Loading branch information
john-tipper committed Nov 23, 2022
1 parent 93ac78c commit a5161eb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/standalone/server-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ const server = slsHttp(
},
{
// We have separate function for handling images. Assets are handled by S3.
binary: false,
// If you wish to return binary data from an API route then set process.env.BINARY_CONTENT_TYPES to be a
// comma-separated list of Content-Types to be treated as binary data.
// c.f. https://github.com/dougmoscrop/serverless-http/blob/master/lib/provider/aws/is-binary.js for details on
// how this works.
provider: 'aws',
basePath: process.env.NEXTJS_LAMBDA_BASE_PATH,
},
Expand Down

0 comments on commit a5161eb

Please sign in to comment.