Skip to content

Commit 0cc934b

Browse files
committed
fix: binaryMediaType in examples now use config compatible with OPTIONS CORS preflight checks
binaryMediaTypes: */* in example causes issue with API Gateway CORS on OPTIONS request fixes #165
1 parent f73684b commit 0cc934b

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

examples/basic/serverless.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@ plugins:
66
custom:
77
apiGateway:
88
binaryMediaTypes:
9-
- image/png
10-
- image/jpeg
11-
- "*/*" # Using */* doesn't have side effects that I can tell. The HTML response works fine.
9+
# You can use the wildcard character (*) to cover multiple media types per https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-payload-encodings.html
10+
# NOTE: Using */* has a side effect as noted at https://github.com/activescott/serverless-aws-static-file-handler
11+
# IANA descrete type wildcards from: https://www.iana.org/assignments/media-types/media-types.xhtml
12+
- application/*
13+
- audio/*
14+
- font/*
15+
- image/*
16+
- video/*
1217

1318
provider:
1419
name: aws

examples/serverless-offline/serverless.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@ plugins:
77
custom:
88
apiGateway:
99
binaryMediaTypes:
10-
- image/png
11-
- image/jpeg
12-
- "*/*" # Using */* doesn't have side effects that I can tell. The HTML response works fine.
10+
# You can use the wildcard character (*) to cover multiple media types per https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-payload-encodings.html
11+
# NOTE: Using */* has a side effect as noted at https://github.com/activescott/serverless-aws-static-file-handler
12+
# IANA descrete type wildcards from: https://www.iana.org/assignments/media-types/media-types.xhtml
13+
- application/*
14+
- audio/*
15+
- font/*
16+
- image/*
17+
- video/*
1318

1419
provider:
1520
name: aws

test-files/basic-project/serverless.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@ plugins:
66
custom:
77
apiGateway:
88
binaryMediaTypes:
9-
- image/png
10-
- image/jpeg
11-
- "*/*" # Using */* doesn't have side effects that I can tell. The HTML response works fine.
9+
# You can use the wildcard character (*) to cover multiple media types per https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-payload-encodings.html
10+
# NOTE: Using */* has a side effect as noted at https://github.com/activescott/serverless-aws-static-file-handler
11+
# IANA descrete type wildcards from: https://www.iana.org/assignments/media-types/media-types.xhtml
12+
- application/*
13+
- audio/*
14+
- font/*
15+
- image/*
16+
- video/*
1217

1318
provider:
1419
name: aws

0 commit comments

Comments
 (0)