Description
A client generated with RpcV2Cbor as its modeled protocol can select RestJson1 at runtime through the config bag. The resulting RestJson1 request incorrectly uses the modeled RpcV2Cbor Accept header:
The multi-protocol Pokemon server rejects the request with HTTP 405.
Reproduction
The complete reproducer is on the upstream branch
fahadzub/4721-accept-error.
Fetch the branch and generate the Pokemon client and server:
git fetch origin fahadzub/4721-accept-error
git switch --detach origin/fahadzub/4721-accept-error
make -C examples
Start the server:
cd examples
cargo run --bin pokemon-service
In another terminal, run the client reproducer:
cd examples
cargo run --quiet \
-p pokemon-service-client-usage \
--example accept-header-repro
The example selects RestJson1 at runtime:
let config = Config::builder()
.endpoint_url(POKEMON_SERVICE_URL)
.protocol(
aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new()
.with_default_namespace("com.aws.example"),
)
.build();
Actual behavior
expected Accept="application/json"
actual Accept=Some("application/cbor")
result=Err(ServiceError(... StatusCode(405) ...))
Expected behavior
The runtime-selected RestJson1 protocol should send:
The request should complete successfully.
Description
A client generated with
RpcV2Cboras its modeled protocol can selectRestJson1at runtime through the config bag. The resultingRestJson1request incorrectly uses the modeledRpcV2CborAcceptheader:The multi-protocol Pokemon server rejects the request with HTTP
405.Reproduction
The complete reproducer is on the upstream branch
fahadzub/4721-accept-error.Fetch the branch and generate the Pokemon client and server:
Start the server:
cd examples cargo run --bin pokemon-serviceIn another terminal, run the client reproducer:
cd examples cargo run --quiet \ -p pokemon-service-client-usage \ --example accept-header-reproThe example selects RestJson1 at runtime:
Actual behavior
Expected behavior
The runtime-selected RestJson1 protocol should send:
The request should complete successfully.