This should allow us to add more middlewares without significantly affecting compile performance (see #7708).
to quote from the code comment:
> The built-in extractors in axum return plain text errors, but our API contract promises JSON errors. This middleware converts such plain text errors into corresponding JSON errors, allowing us to us…
Surprisingly, clippy does not warn about todo!() by default. This PR changes that to avoid us unintentionally pushing work-in-progress code to the main branch.
If we only ever put "Service unavailable" in it we might as well simplify the code :D
This makes the function a bit more generic and reduces our reliance on Bytes. Instead of using .body(Bytes::new()) we can now use .body("") which shrinks the code a bit. .body(()) is unfortunately not possible yet (see https://gi…
The middleware that is responsible for rejecting requests without a User-Agent header runs after the middleware that logs requests. The request logging middleware however was expecting a TypedHeader<UserAgent>, which meant that reque…
Looks like the two layers above it aren't actually necessary 🤷♂️
This PR upgrades our projects to axum 0.7 and hyper 1.x.
The changes on the axum side are described by https://tokio.rs/blog/2023-11-27-announcing-axum-0-7-0
Unfortunately there appears to be no way to adopt most of these breaking …
There is no need for the _SECONDS suffix if we use Duration directly for the const :)
Having RequestBodyTimeoutLayer (which changes the Body type of the Request) in the middle of the ServiceBuilder has already been hard to deal with in the past, and does not seem to work anymore with axum 0.7. This change moves th…
In the current situation reqwest reexports the header code from the http crate. However once we update hyper to 1.x we will have two copies of the http crate, with differing major versions. This leads to conflicts between the hea…
We know the exact status code that we expect, so we might as well use assert_eq!() instead of the custom matcher implementation.
This should make our migration to axum 0.7 and hyper 1.x a little easier since our version of reqwest is currently not compatible with hyper 1.x.
This should automate the first part of https://ops-guide.crates.io/ops/index-squash.html#manual-work
This is the final middleware that needed to be migrated to axum. The rest of the middlewares are only relevant to the conduit route handlers.
Instead of reading all environment variables when we create the middleware, we outsource this to the server config construction and then access the relevant values via request.app().config.
The reason for this change is that axum …
Another PR, another middleware migrated from conduit to axum… 🚀
This is similar to the RequestCounter of the balance_capacity middleware and ensures that the gauge is decreased again even if a different exit path out of the method is used somehow (i.e. panic!()).
This PR is migrating most of our static file serving from conduit to `axum.
Previously the middleware was configurable with a path, but axum middlewares make this a bit more complicated (can't use from_fn()). Since we only need …
This PR migrates our header-based traffic blocking middleware to axum. It is slightly different from the original conduit middleware in that we perform the iteration inside the middleware instead of applying the middleware N times.