|
2 | 2 |
|
3 | 3 | Enables Lambdas to return responses larger than 6MB by offloading the content to S3 and returning a reference to the S3 file.
|
4 | 4 |
|
5 |
| - |
| 5 | +<p align="center"> |
| 6 | +<img src="./docs/out/architecture-1/Architecture%20-%20Sequence%20Diagram.svg" /> |
| 7 | +</p> |
6 | 8 |
|
7 |
| -When a client can handle a Large Response, it must send a request with the HTTP Header Accept: application/large-response.vnd+json. The application/large-response.vnd+json is a custom MIME type indicating that the client agrees to receive a large response payload when necessary. The response body for the large-response.vnd+json MIME type is in the following format: |
| 9 | +When a client can handle a Large Response, it must send a request with the HTTP Header `Accept: application/large-response.vnd+json`. The `application/large-response.vnd+json` is a custom MIME type indicating that the client agrees to receive a large response payload when necessary. The response body for the `large-response.vnd+json` MIME type is in the following format: |
8 | 10 |
|
9 | 11 | ```json
|
10 | 12 | {
|
11 | 13 | "$payload_ref": "http://<s3 file reference link>"
|
12 | 14 | }
|
13 | 15 | ```
|
14 | 16 |
|
15 |
| -If the client provides the large response MIME type, the Lambda will not log an error using Log.error. Instead, it will rewrite the original response with a reference to the offloaded large payload. Furthermore, the rewritten response will include the HTTP header Content-Type with the value application/large-response.vnd+json. |
| 17 | +If the client provides the large response MIME type, the Lambda will not log an error using `Log.error`. Instead, it will rewrite the original response with a reference to the offloaded large payload. Furthermore, the rewritten response will include the HTTP header `Content-Type` with the value `application/large-response.vnd+json`. |
16 | 18 |
|
17 |
| -If the client does not provide the large response MIME type, the Lambda will log an error with Log.error, and the response will fail due to an excessively large response body. |
| 19 | +If the client does not provide the large response MIME type, the Lambda will log an error with `Log.error`, and the response will fail due to an excessively large response body. |
18 | 20 |
|
19 | 21 | ### Middleware Configuration:
|
20 | 22 |
|
21 | 23 | Supported Parameters:
|
22 | 24 |
|
23 | 25 | | Parameter | Type | Description |
|
24 | 26 | | --------------- | ----------------- | ---------------------------------------------------------------------------- |
|
25 |
| -| thresholdWarn | number | Warning threshold level (percentage of `sizeLimitInMB`), e.g: 0.80 | |
26 |
| -| thresholdError | number | Error threshold level (percentage of `sizeLimitInMB`), e.g: 0.90 | |
27 |
| -| sizeLimitInMB | number | Maximum allowed size limit in MB, e.g 6 | |
28 |
| -| outputBucket | string | Identifier or name of the output S3 bucket | |
29 |
| -| groupRequestsBy | function - mapper | Function to group requests, based on API Gateway event V2. Defaults to 'all' | |
| 27 | +| thresholdWarn | `number` | Warning threshold level (percentage of `sizeLimitInMB`), e.g: 0.80 | |
| 28 | +| thresholdError | `number` | Error threshold level (percentage of `sizeLimitInMB`), e.g: 0.90 | |
| 29 | +| sizeLimitInMB | `number` | Maximum allowed size limit in MB, e.g 6 | |
| 30 | +| outputBucket | `string` | Identifier or name of the output S3 bucket | |
| 31 | +| groupRequestsBy | `function - mapper` | Function to group requests, based on API Gateway event V2. Defaults to 'all' | |
30 | 32 |
|
31 | 33 | Example Usage:
|
32 | 34 |
|
|
0 commit comments