Skip to content

Commit c1019f3

Browse files
author
João Pinho
committed
Merge branch 'main' of github.com:epilot-dev/aws-lambda-utility-middlewares
2 parents 9fd01d6 + 4e6297a commit c1019f3

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

packages/large-response-middleware/README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,33 @@
22

33
Enables Lambdas to return responses larger than 6MB by offloading the content to S3 and returning a reference to the S3 file.
44

5-
![](../../docs/out/architecture-1/Architecture%20-%20Sequence%20Diagram.svg)
5+
<p align="center">
6+
<img src="./docs/out/architecture-1/Architecture%20-%20Sequence%20Diagram.svg" />
7+
</p>
68

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:
810

911
```json
1012
{
1113
"$payload_ref": "http://<s3 file reference link>"
1214
}
1315
```
1416

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`.
1618

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.
1820

1921
### Middleware Configuration:
2022

2123
Supported Parameters:
2224

2325
| Parameter | Type | Description |
2426
| --------------- | ----------------- | ---------------------------------------------------------------------------- |
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' |
3032

3133
Example Usage:
3234

0 commit comments

Comments
 (0)