smithy-rs/tools/echo-server
John DiSanti aa1f556ae0
Upgrade nightly used in CI (#3073)
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._

---------

Co-authored-by: ysaito1001 <awsaito@amazon.com>
2023-12-14 11:30:23 -08:00
..
src add: echo-server tool w/ README (#1432) 2022-06-02 11:25:11 -05:00
Cargo.lock Upgrade nightly used in CI (#3073) 2023-12-14 11:30:23 -08:00
Cargo.toml Update dependencies flagged by cargo audit (#2753) 2023-06-12 17:09:29 +00:00
README.md add: echo-server tool w/ README (#1432) 2022-06-02 11:25:11 -05:00

README.md

echo-server

This is a tool that Zelda created while implementing the flexible checksums feature. It's a simple echo server that will log the requests it receives.

How to use it

First, start the echo server:

cargo run

Then, configure the SDK to send requests to this server by setting an immutable endpoint when building the SdkConfig:

  #[tokio::test]
  async fn test_checksum_on_streaming_request_against_s3() {
      let sdk_config = aws_config::from_env()
          .endpoint_resolver(Endpoint::immutable("http://localhost:3000".parse().expect("valid URI")))
          .load().await;
      let s3_client = aws_sdk_s3::Client::new(&sdk_config);

      let _res = s3_client
          .put_object()
          .bucket("some-real-bucket")
          .key("test.txt")
          .body(aws_sdk_s3::types::ByteStream::from_static(b"Hello world"))
          .checksum_algorithm(ChecksumAlgorithm::Sha256)
          .send()
          .await
          .unwrap();
  }

Once you run your app and start making requests, those requests will be logged by the echo server. The echo server doesn't return valid responses, so you'll have to account for that.

Acknowledgements

This server is based on the print-request-response example from the axum repo