Unverified Commit a8627df5 authored by david-perez's avatar david-perez Committed by GitHub
Browse files

Add panic message when `httpMalformedRequestTests` fail (#2212)

parent 95dc365d
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -486,13 +486,15 @@ class ServerProtocolTestGenerator(
    ) {
        val (_, outputT) = operationInputOutputTypes[operationShape]!!

        val panicMessage = "request should have been rejected, but we accepted it; we parsed operation input `{:?}`"

        rust("// Use the `OperationRegistryBuilder`")
        rustBlock("") {
            with(testCase.request) {
                // TODO(https://github.com/awslabs/smithy/issues/1102): `uri` should probably not be an `Optional`.
                renderHttpRequest(uri.get(), method, headers, body.orNull(), queryParams, host.orNull())
            }
            makeRequest(operationShape, this, writable("todo!() as $outputT"))
            makeRequest(operationShape, this, writable("""panic!("$panicMessage", &input) as $outputT"""))
            checkResponse(this, testCase.response)
        }

@@ -502,7 +504,7 @@ class ServerProtocolTestGenerator(
                // TODO(https://github.com/awslabs/smithy/issues/1102): `uri` should probably not be an `Optional`.
                renderHttpRequest(uri.get(), method, headers, body.orNull(), queryParams, host.orNull())
            }
            makeRequest2(operationShape, operationSymbol, this, writable("todo!() as $outputT"))
            makeRequest2(operationShape, operationSymbol, this, writable("""panic!("$panicMessage", &input) as $outputT"""))
            checkResponse(this, testCase.response)
        }
    }