generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 221
Open
Labels
Description
And the incoming value is not valid UTF-8. Indeed, consider:
@http(uri: "/http-payload-on-string", method: "POST")
operation HttpPayloadOnStringOperation {
input: HttpPayloadOnString
}
structure HttpPayloadOnString {
@httpPayload
message: String
}We generate:
pub(crate) fn de_message_payload(
body: &[u8],
) -> std::result::Result<
::std::option::Option<::std::string::String>,
::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
> {
(!body.is_empty())
.then(|| {
let body_str = std::str::from_utf8(body)?;
Ok(body_str.to_string())
})
.transpose()
}What RequestRejection do we yield? We're leveraging this #[from] conversion when using ? above:
smithy-rs/rust-runtime/aws-smithy-http-server/src/protocol/rest_json_1/rejection.rs
Lines 150 to 151 in dcf16ac
| #[error("request URI cannot be percent decoded into valid UTF-8")] | |
| PercentEncodedUriNotValidUtf8(#[from] core::str::Utf8Error), |
Thus returning an incorrect rejection. We're not percent-decoding a URI here!