moto icon indicating copy to clipboard operation
moto copied to clipboard

Moto returns wrong code for DryRun requests

Open synerdjin opened this issue 7 years ago • 2 comments

Moto returns 400 fro dryRun request when it is actually should be 412.

Moto response example:

HTTP/1.0 400 BAD REQUEST
status: 400
server: amazon.com
Content-Type: text/html; charset=utf-8
Content-Length: 388
Date: Fri, 07 Dec 2018 18:38:32 GMT

<?xml version="1.0" encoding="UTF-8"?>
  <Response>
    <Errors>
      <Error>
        <Code>DryRunOperation</Code>
        <Message>An error occurred (DryRunOperation) when calling the DescribeInstances operation: Request would have succeeded, but DryRun flag is set</Message>
        
      </Error>
    </Errors>
  <RequestID>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestID>
</Response>

AWS respons example:

HTTP/1.1 412 Precondition Failed
Transfer-Encoding: chunked
Date: Fri, 07 Dec 2018 18:16:40 GMT
Server: AmazonEC2

fb
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>DryRunOperation</Code><Message>Request would have succeeded, but DryRun flag is set.</Message></Error></Errors><RequestID>7dde7961-fbfd-4731-8600-7a1f62a32e3c</RequestID></Response>
0

Thank you!

synerdjin avatar Dec 07 '18 20:12 synerdjin

Thanks; setting as a feature request.

spulec avatar Dec 29 '18 02:12 spulec

Thank you @spulec! Please not that this issue depends on problem described here: https://github.com/pallets/werkzeug/issues/1231. It will be fixed with next version of werkzeug.

synerdjin avatar Jan 02 '19 16:01 synerdjin