[{"data":1,"prerenderedAt":34},["ShallowReactive",2],{"snippet-apigateway-mock-integration-binary-media-types":3},{"id":4,"title":5,"contributors":6,"description":8,"extension":9,"gitHub":10,"introBox":13,"languages":18,"meta":20,"resources":21,"services":22,"snippets":24,"stem":29,"tags":30,"type":32,"__hash__":33},"snippets\u002Fsnippets\u002Fapigateway-mock-integration-binary-media-types.json","Disable Content-Type conversion in Mock integration",[7],"content\u002Fcontributors\u002Fpallavi-bhat.json","Using AWS CLI to disable Content-Type conversion in MOCK integration when Binary media types are enabled on API Gateway.","json",{"template":11},{"repoURL":12},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-snippets\u002Ftree\u002Fmain\u002Fapigateway-mock-integration-binary-media-types",{"headline":14,"text":15},"How it works",[16,17],"When Binary Media Types are enabled on a REST API with '\u002F' or 'application\u002Fjson', API Gateway converts payloads based on Content-Type headers, but MOCK integrations don't support binary content. This often results in 500 error.","To resolve this, the Content Handling behavior must be set to 'CONVERT_TO_TEXT' for the Integration request, which can only be done via AWS CLI and not via the console at the moment.",[19],"bash",{},null,[23],"apigw",[25],{"title":26,"language":27,"code":28},"The contentHandling property of the MOCK Integration can be set to CONVERT_TO_TEXT using the following CLI command (NOTE: replace the API ID, resource ID and AWS region):","cli","aws apigateway update-integration --rest-api-id &#60;your-rest-api-id&#62; --resource-id &#60;resource-id&#62; --http-method OPTIONS --patch-operations \"op='replace' ,path='\u002FcontentHandling' ,value='CONVERT_TO_TEXT'\" --region &#60;region-of-api&#62;","snippets\u002Fapigateway-mock-integration-binary-media-types",[31],"API Gateway","Integration","yJGm3Hbg01A3cJJzIw0Vr11fwUxVLX5S1h0e8-yJS2I",1792578863879]