Skip to content

Commit 3ec28ba

Browse files
committed
chore: [#468] add new features to propagate ID in requests
Add new features to `tower-http` crate to propagate the request ID to the response. If the request does not have an ID it sets a newly generated UUID. ``` $ curl -i localhost:3001/v1/about/license HTTP/1.1 200 OK content-type: text/html; charset=utf-8 content-length: 1262 x-request-id: cea0efcd-84e0-4f59-96b3-625ca4154396 date: Mon, 12 Feb 2024 16:58:05 GMT ``` ``` $ curl -i -H "x-request-id: a5030c7a-5302-49d4-8e66-f0f0ab0e3ce3" localhost:3001/v1/about/license HTTP/1.1 200 OK content-type: text/html; charset=utf-8 content-length: 1262 x-request-id: a5030c7a-5302-49d4-8e66-f0f0ab0e3ce3 date: Mon, 12 Feb 2024 16:59:31 GMT ``` This commit onlu adds the needed features.
1 parent e5ebcc0 commit 3ec28ba

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ thiserror = "1"
7474
tokio = { version = "1", features = ["fs", "io-util", "macros", "net", "rt-multi-thread", "signal", "sync", "time"] }
7575
toml = "0"
7676
torrust-index-located-error = { version = "3.0.0-alpha.3-develop", path = "packages/located-error" }
77-
tower-http = { version = "0", features = ["compression-full", "cors", "trace"] }
77+
tower-http = { version = "0", features = ["compression-full", "cors", "trace", "propagate-header", "request-id"] }
7878
trace = "0.1.7"
7979
tracing = "0.1.40"
8080
urlencoding = "2"

0 commit comments

Comments
 (0)