Workaround needed for broken OPTIONS when */* is configured as a binary type
- Dominant language
- Python
- Stars
- 11.1k
- Forks
- 1k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 2
Description
Not sure if this is the right place for this suggestion....
**Problem**
When `*/*` is configured as a binary type, an OPTIONS request to an end point created with Chalice fails with code 500 (`{"message": "Internal server error"}`). Taking with Amazon support, this is because the API Gateway will try to convert the MOCK integration response to binary (which is by default empty).
Chalice appears to set up a MOCK integration response for OPTIONS.
**Current workaround**
Currently the only way I can find to make OPTIONS work when `*/*` is configured as a binary type is to run the following command:
```
aws apigateway update-integration --rest-api-id --resource-id --http-method OPTIONS --patch-operations op='replace',path='/contentHandling',value='CONVERT_TO_TEXT'
```
And re-deploy the API from the AWS console.
This needs to be done each time you run `chalice deploy` as the setting appears to be lost.
**Suggestion**
Detect when `*/*` is configured as a binary type and run `update-integration` as part of the deployment process as above to allow OPTIONS requests work. I have no idea how to do this - but would make the behaviour much less confusing dealing with clients that send `Accept: */*` in the header!
cc: @petescarth
Contributor guide
Assessment
This issue has not been assessed yet.