reqwest-middleware-0.4.2/.cargo_vcs_info.json0000644000000001600000000000100146410ustar { "git": { "sha1": "591ab444ec58b0e241724fef8a76a655dcaafdbc" }, "path_in_vcs": "reqwest-middleware" }reqwest-middleware-0.4.2/CHANGELOG.md000064400000000000000000000074161046102023000152550ustar 00000000000000# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] ## [0.4.2] - 2025-04-08 ### Added - Deprecated `fetch_mode_no_cors` as it's been deprecated in reqwest. ## [0.4.1] - 2025-02-24 - Fixed wasm32 by disabling incompatible parts. On that target, `ClientWithMiddleware` is no longer a Tower service and has no `ClientWithMiddleware::timeout` function. ### Changed - Updated `wasm-timer` to `wasmtimer` ## [0.4.0] - 2024-11-08 ### Breaking Changes - `request_middleware::Error` is now a transparent error enum and doesn't add its own context anymore. ## [0.3.3] - 2024-07-08 ### Added - Implemented `Default` on `ClientWithMiddleware` ([#179](https://github.com/TrueLayer/reqwest-middleware/pull/179)) ## [0.3.2] - 2024-06-28 ### Added - Added re-export of `reqwest`. - `http2`, `rustls-tls`, and `charset` features, which simply enable those features in `reqwest`. ## [0.3.1] ### Fixed - Included license files in crates - Fix logging of User-Agent header in reqwest-tracing ### Added - Added `with_retry_log_level` to `RetryTransientMiddleware` in reqwest-retry - Added `ClientBuilder::from_client` ## [0.3.0] - 2024-04-10 ### Breaking changes - Upgraded `reqwest` to `0.12.0` * Removed default-features `json` and `multipart` from `reqwest` dependency * Added `json` and `multipart` features to `reqwest-middleware` - Upgraded `matchit` to `0.8.0` * You may need to update some matches that look like `/a/:some_var` to `/a/{some_var}` - Removed `task_local_extensions` in favour of `http::Extensions` * All extensions must be `Clone` now. ### Changed - `RequestBuilder::try_clone` now clones the extensions. ### Added - Implemented `Service` for `ClientWithMiddleware` to have more feature parity with `reqwest`. - Added more methods like `build_split` to have more feature parity with `reqwest.` - Added more documentation ### [0.2.5] - 2024-03-15 ### Changed - Updated minimum version of `reqwest` to `0.11.10`. url_mut, with_url, without_url functions are added after `0.11.10`. ### [0.2.4] - 2023-09-21 ### Added - Added `fetch_mode_no_cors` method to `reqwest_middleware::RequestBuilder` ## [0.2.3] - 2023-08-07 ### Added - Added all `reqwest::Error` methods for `reqwest_middleware::Error` ## [0.2.2] - 2023-05-11 ### Added - `RequestBuilder::version` method to configure the HTTP version ## [0.2.1] - 2023-03-09 ### Added - Support for `wasm32-unknown-unknown` ## [0.2.0] - 2022-11-15 ### Changed - `RequestBuilder::try_clone` has a fixed function signature now ### Removed - `RequestBuilder::send_with_extensions` - use `RequestBuilder::with_extensions` + `RequestBuilder::send` instead. ### Added - Implementation of `Debug` trait for `RequestBuilder`. - A new `RequestInitialiser` trait that can be added to `ClientWithMiddleware` - A new `Extension` initialiser that adds extensions to each request - Adds `with_extension` method functionality to `RequestBuilder` that can add extensions for the `send` method to use. ## [0.1.6] - 2022-04-21 Absolutely nothing changed ## [0.1.5] - 2022-02-21 ### Added - Added support for `opentelemetry` version `0.17`. ## [0.1.4] - 2022-01-24 ### Changed - Made `Debug` impl for `ClientWithExtensions` non-exhaustive. ## [0.1.3] - 2021-10-18 ### Security - remove time v0.1 dependency ### Fixed - Handle the `hyper::Error(IncompleteMessage)` as a `Retryable::Transient`. ## [0.1.2] - 2021-09-28 ### Changed - Disabled default features on `reqwest` - Replaced `truelayer-extensions` with `task-local-extensions` ## [0.1.1] ### Added - New methods on `ClientWithExtensions` and `RequestBuilder` for sending requests with initial extensions. reqwest-middleware-0.4.2/Cargo.lock0000644000001431370000000000100126300ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 4 [[package]] name = "addr2line" version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] [[package]] name = "adler2" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "aho-corasick" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "anyhow" version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" [[package]] name = "assert-json-diff" version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47e4f2b81832e72834d7518d8487a0396a28cc408186a2e8854c0f98011faf12" dependencies = [ "serde", "serde_json", ] [[package]] name = "async-trait" version = "0.1.88" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "atomic-waker" version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", "windows-targets 0.52.6", ] [[package]] name = "base64" version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bitflags" version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] name = "bumpalo" version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "bytes" version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "cc" version = "1.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" dependencies = [ "shlex", ] [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cfg_aliases" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "core-foundation" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", ] [[package]] name = "core-foundation-sys" version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "deadpool" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb84100978c1c7b37f09ed3ce3e5f843af02c2a2c431bae5b19230dad2c1b490" dependencies = [ "async-trait", "deadpool-runtime", "num_cpus", "tokio", ] [[package]] name = "deadpool-runtime" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "092966b41edc516079bdf31ec78a2e0588d1d0c08f78b91d8307215928642b2b" [[package]] name = "displaydoc" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "encoding_rs" version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ "cfg-if", ] [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", "windows-sys 0.59.0", ] [[package]] name = "fastrand" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foreign-types" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ "foreign-types-shared", ] [[package]] name = "foreign-types-shared" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] [[package]] name = "futures" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", "futures-executor", "futures-io", "futures-sink", "futures-task", "futures-util", ] [[package]] name = "futures-channel" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", ] [[package]] name = "futures-core" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", "futures-util", ] [[package]] name = "futures-io" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "futures-sink" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", "futures-io", "futures-macro", "futures-sink", "futures-task", "memchr", "pin-project-lite", "pin-utils", "slab", ] [[package]] name = "getrandom" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", "wasm-bindgen", ] [[package]] name = "getrandom" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" dependencies = [ "cfg-if", "js-sys", "libc", "r-efi", "wasi 0.14.2+wasi-0.2.4", "wasm-bindgen", ] [[package]] name = "gimli" version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "h2" version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5017294ff4bb30944501348f6f8e42e6ad28f42c8bbef7a74029aff064a4e3c2" dependencies = [ "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", "http", "indexmap", "slab", "tokio", "tokio-util", "tracing", ] [[package]] name = "hashbrown" version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" [[package]] name = "hermit-abi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "http" version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" dependencies = [ "bytes", "fnv", "itoa", ] [[package]] name = "http-body" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", "http", ] [[package]] name = "http-body-util" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" dependencies = [ "bytes", "futures-core", "http", "http-body", "pin-project-lite", ] [[package]] name = "httparse" version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] name = "httpdate" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" dependencies = [ "bytes", "futures-channel", "futures-util", "h2", "http", "http-body", "httparse", "httpdate", "itoa", "pin-project-lite", "smallvec", "tokio", "want", ] [[package]] name = "hyper-rustls" version = "0.27.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" dependencies = [ "futures-util", "http", "hyper", "hyper-util", "rustls", "rustls-pki-types", "tokio", "tokio-rustls", "tower-service", "webpki-roots", ] [[package]] name = "hyper-tls" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", "hyper", "hyper-util", "native-tls", "tokio", "tokio-native-tls", "tower-service", ] [[package]] name = "hyper-util" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ "bytes", "futures-channel", "futures-util", "http", "http-body", "hyper", "pin-project-lite", "socket2", "tokio", "tower-service", "tracing", ] [[package]] name = "icu_collections" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" dependencies = [ "displaydoc", "yoke", "zerofrom", "zerovec", ] [[package]] name = "icu_locid" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" dependencies = [ "displaydoc", "litemap", "tinystr", "writeable", "zerovec", ] [[package]] name = "icu_locid_transform" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" dependencies = [ "displaydoc", "icu_locid", "icu_locid_transform_data", "icu_provider", "tinystr", "zerovec", ] [[package]] name = "icu_locid_transform_data" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" [[package]] name = "icu_normalizer" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" dependencies = [ "displaydoc", "icu_collections", "icu_normalizer_data", "icu_properties", "icu_provider", "smallvec", "utf16_iter", "utf8_iter", "write16", "zerovec", ] [[package]] name = "icu_normalizer_data" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" [[package]] name = "icu_properties" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" dependencies = [ "displaydoc", "icu_collections", "icu_locid_transform", "icu_properties_data", "icu_provider", "tinystr", "zerovec", ] [[package]] name = "icu_properties_data" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" [[package]] name = "icu_provider" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" dependencies = [ "displaydoc", "icu_locid", "icu_provider_macros", "stable_deref_trait", "tinystr", "writeable", "yoke", "zerofrom", "zerovec", ] [[package]] name = "icu_provider_macros" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "idna" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" dependencies = [ "idna_adapter", "smallvec", "utf8_iter", ] [[package]] name = "idna_adapter" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" dependencies = [ "icu_normalizer", "icu_properties", ] [[package]] name = "indexmap" version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" dependencies = [ "equivalent", "hashbrown", ] [[package]] name = "ipnet" version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" [[package]] name = "itoa" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "js-sys" version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ "once_cell", "wasm-bindgen", ] [[package]] name = "libc" version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] name = "linux-raw-sys" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe7db12097d22ec582439daf8618b8fdd1a7bef6270e9af3b1ebcd30893cf413" [[package]] name = "litemap" version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" [[package]] name = "log" version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "memchr" version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "mime" version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "mime_guess" version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" dependencies = [ "mime", "unicase", ] [[package]] name = "miniz_oxide" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5" dependencies = [ "adler2", ] [[package]] name = "mio" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ "libc", "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.52.0", ] [[package]] name = "native-tls" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" dependencies = [ "libc", "log", "openssl", "openssl-probe", "openssl-sys", "schannel", "security-framework", "security-framework-sys", "tempfile", ] [[package]] name = "num_cpus" version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ "hermit-abi", "libc", ] [[package]] name = "object" version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ "memchr", ] [[package]] name = "once_cell" version = "1.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" [[package]] name = "openssl" version = "0.10.71" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e14130c6a98cd258fdcb0fb6d744152343ff729cbfcb28c656a9d12b999fbcd" dependencies = [ "bitflags", "cfg-if", "foreign-types", "libc", "once_cell", "openssl-macros", "openssl-sys", ] [[package]] name = "openssl-macros" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "openssl-probe" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" [[package]] name = "openssl-sys" version = "0.9.106" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bb61ea9811cc39e3c2069f40b8b8e2e70d8569b361f879786cc7ed48b777cdd" dependencies = [ "cc", "libc", "pkg-config", "vcpkg", ] [[package]] name = "percent-encoding" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project-lite" version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "ppv-lite86" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ "zerocopy", ] [[package]] name = "proc-macro2" version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] [[package]] name = "quinn" version = "0.11.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3bd15a6f2967aef83887dcb9fec0014580467e33720d073560cf015a5683012" dependencies = [ "bytes", "cfg_aliases", "pin-project-lite", "quinn-proto", "quinn-udp", "rustc-hash", "rustls", "socket2", "thiserror 2.0.12", "tokio", "tracing", "web-time", ] [[package]] name = "quinn-proto" version = "0.11.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b820744eb4dc9b57a3398183639c511b5a26d2ed702cedd3febaa1393caa22cc" dependencies = [ "bytes", "getrandom 0.3.2", "rand", "ring", "rustc-hash", "rustls", "rustls-pki-types", "slab", "thiserror 2.0.12", "tinyvec", "tracing", "web-time", ] [[package]] name = "quinn-udp" version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e46f3055866785f6b92bc6164b76be02ca8f2eb4b002c0354b28cf4c119e5944" dependencies = [ "cfg_aliases", "libc", "once_cell", "socket2", "tracing", "windows-sys 0.59.0", ] [[package]] name = "quote" version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] [[package]] name = "r-efi" version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" [[package]] name = "rand" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" dependencies = [ "rand_chacha", "rand_core", "zerocopy", ] [[package]] name = "rand_chacha" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", "rand_core", ] [[package]] name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ "getrandom 0.3.2", ] [[package]] name = "regex" version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", "regex-automata", "regex-syntax", ] [[package]] name = "regex-automata" version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", "regex-syntax", ] [[package]] name = "regex-syntax" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" version = "0.12.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d19c46a6fdd48bc4dab94b6103fccc55d34c67cc0ad04653aad4ea2a07cd7bbb" dependencies = [ "base64", "bytes", "encoding_rs", "futures-core", "futures-util", "h2", "http", "http-body", "http-body-util", "hyper", "hyper-rustls", "hyper-tls", "hyper-util", "ipnet", "js-sys", "log", "mime", "mime_guess", "native-tls", "once_cell", "percent-encoding", "pin-project-lite", "quinn", "rustls", "rustls-pemfile", "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", "system-configuration", "tokio", "tokio-native-tls", "tokio-rustls", "tower", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", "webpki-roots", "windows-registry", ] [[package]] name = "reqwest-middleware" version = "0.4.2" dependencies = [ "anyhow", "async-trait", "http", "reqwest", "serde", "thiserror 1.0.69", "tokio", "tower-service", "wiremock", ] [[package]] name = "ring" version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", "getrandom 0.2.15", "libc", "untrusted", "windows-sys 0.52.0", ] [[package]] name = "rustc-demangle" version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hash" version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustix" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e56a18552996ac8d29ecc3b190b4fdbb2d91ca4ec396de7bbffaf43f3d637e96" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", "windows-sys 0.59.0", ] [[package]] name = "rustls" version = "0.23.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "822ee9188ac4ec04a2f0531e55d035fb2de73f18b41a63c70c2712503b6fb13c" dependencies = [ "once_cell", "ring", "rustls-pki-types", "rustls-webpki", "subtle", "zeroize", ] [[package]] name = "rustls-pemfile" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ "rustls-pki-types", ] [[package]] name = "rustls-pki-types" version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" dependencies = [ "web-time", ] [[package]] name = "rustls-webpki" version = "0.103.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0aa4eeac2588ffff23e9d7a7e9b3f971c5fb5b7ebc9452745e0c232c64f83b2f" dependencies = [ "ring", "rustls-pki-types", "untrusted", ] [[package]] name = "rustversion" version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" [[package]] name = "ryu" version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "schannel" version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" dependencies = [ "windows-sys 0.59.0", ] [[package]] name = "security-framework" version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags", "core-foundation", "core-foundation-sys", "libc", "security-framework-sys", ] [[package]] name = "security-framework-sys" version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" dependencies = [ "core-foundation-sys", "libc", ] [[package]] name = "serde" version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "serde_json" version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ "itoa", "memchr", "ryu", "serde", ] [[package]] name = "serde_urlencoded" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", "itoa", "ryu", "serde", ] [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "slab" version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" [[package]] name = "socket2" version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", "windows-sys 0.52.0", ] [[package]] name = "stable_deref_trait" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "subtle" version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "sync_wrapper" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" dependencies = [ "futures-core", ] [[package]] name = "synstructure" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "system-configuration" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ "bitflags", "core-foundation", "system-configuration-sys", ] [[package]] name = "system-configuration-sys" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" dependencies = [ "core-foundation-sys", "libc", ] [[package]] name = "tempfile" version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" dependencies = [ "fastrand", "getrandom 0.3.2", "once_cell", "rustix", "windows-sys 0.59.0", ] [[package]] name = "thiserror" version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl 1.0.69", ] [[package]] name = "thiserror" version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ "thiserror-impl 2.0.12", ] [[package]] name = "thiserror-impl" version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "thiserror-impl" version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "tinystr" version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ "displaydoc", "zerovec", ] [[package]] name = "tinyvec" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" dependencies = [ "tinyvec_macros", ] [[package]] name = "tinyvec_macros" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" version = "1.44.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f382da615b842244d4b8738c82ed1275e6c5dd90c459a30941cd07080b06c91a" dependencies = [ "backtrace", "bytes", "libc", "mio", "pin-project-lite", "socket2", "tokio-macros", "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "tokio-native-tls" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" dependencies = [ "native-tls", "tokio", ] [[package]] name = "tokio-rustls" version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" dependencies = [ "rustls", "tokio", ] [[package]] name = "tokio-util" version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b9590b93e6fcc1739458317cccd391ad3955e2bde8913edf6f95f9e65a8f034" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", ] [[package]] name = "tower" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ "futures-core", "futures-util", "pin-project-lite", "sync_wrapper", "tokio", "tower-layer", "tower-service", ] [[package]] name = "tower-layer" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" [[package]] name = "tower-service" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", "tracing-core", ] [[package]] name = "tracing-core" version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", ] [[package]] name = "try-lock" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "unicase" version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" [[package]] name = "unicode-ident" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "untrusted" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] [[package]] name = "utf16_iter" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" [[package]] name = "utf8_iter" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "vcpkg" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "want" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ "try-lock", ] [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasi" version = "0.14.2+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" dependencies = [ "wit-bindgen-rt", ] [[package]] name = "wasm-bindgen" version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", "once_cell", "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", "proc-macro2", "quote", "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" version = "0.4.50" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" dependencies = [ "cfg-if", "js-sys", "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" dependencies = [ "unicode-ident", ] [[package]] name = "web-sys" version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" dependencies = [ "js-sys", "wasm-bindgen", ] [[package]] name = "web-time" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ "js-sys", "wasm-bindgen", ] [[package]] name = "webpki-roots" version = "0.26.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2210b291f7ea53617fbafcc4939f10914214ec15aace5ba62293a668f322c5c9" dependencies = [ "rustls-pki-types", ] [[package]] name = "windows-link" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" [[package]] name = "windows-registry" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3" dependencies = [ "windows-result", "windows-strings", "windows-targets 0.53.0", ] [[package]] name = "windows-result" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" dependencies = [ "windows-link", ] [[package]] name = "windows-strings" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319" dependencies = [ "windows-link", ] [[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ "windows-targets 0.52.6", ] [[package]] name = "windows-sys" version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ "windows-targets 0.52.6", ] [[package]] name = "windows-targets" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", "windows_i686_gnullvm 0.52.6", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", "windows_x86_64_msvc 0.52.6", ] [[package]] name = "windows-targets" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b" dependencies = [ "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", "windows_i686_gnullvm 0.53.0", "windows_i686_msvc 0.53.0", "windows_x86_64_gnu 0.53.0", "windows_x86_64_gnullvm 0.53.0", "windows_x86_64_msvc 0.53.0", ] [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_gnullvm" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_aarch64_msvc" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" [[package]] name = "windows_i686_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnu" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_gnullvm" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_i686_msvc" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnu" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_gnullvm" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "windows_x86_64_msvc" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" [[package]] name = "wiremock" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "101681b74cd87b5899e87bcf5a64e83334dd313fcd3053ea72e6dba18928e301" dependencies = [ "assert-json-diff", "async-trait", "base64", "deadpool", "futures", "http", "http-body-util", "hyper", "hyper-util", "log", "once_cell", "regex", "serde", "serde_json", "tokio", "url", ] [[package]] name = "wit-bindgen-rt" version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ "bitflags", ] [[package]] name = "write16" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" [[package]] name = "writeable" version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" [[package]] name = "yoke" version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" dependencies = [ "serde", "stable_deref_trait", "yoke-derive", "zerofrom", ] [[package]] name = "yoke-derive" version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", "syn", "synstructure", ] [[package]] name = "zerocopy" version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "zerofrom" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", "syn", "synstructure", ] [[package]] name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" [[package]] name = "zerovec" version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" dependencies = [ "yoke", "zerofrom", "zerovec-derive", ] [[package]] name = "zerovec-derive" version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", "syn", ] reqwest-middleware-0.4.2/Cargo.toml0000644000000033550000000000100126500ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2018" name = "reqwest-middleware" version = "0.4.2" authors = ["Rodrigo Gryzinski "] build = false autolib = false autobins = false autoexamples = false autotests = false autobenches = false description = "Wrapper around reqwest to allow for client middleware chains." readme = "README.md" keywords = [ "reqwest", "http", "middleware", ] categories = ["web-programming::http-client"] license = "MIT OR Apache-2.0" repository = "https://github.com/TrueLayer/reqwest-middleware" [features] charset = ["reqwest/charset"] http2 = ["reqwest/http2"] json = ["reqwest/json"] multipart = ["reqwest/multipart"] rustls-tls = ["reqwest/rustls-tls"] [lib] name = "reqwest_middleware" path = "src/lib.rs" [dependencies.anyhow] version = "1.0.0" [dependencies.async-trait] version = "0.1.51" [dependencies.http] version = "1.0.0" [dependencies.reqwest] version = "0.12.0" default-features = false [dependencies.serde] version = "1.0.106" [dependencies.thiserror] version = "1.0.21" [dependencies.tower-service] version = "0.3.0" [dev-dependencies.reqwest] version = "0.12.0" features = ["rustls-tls"] [dev-dependencies.tokio] version = "1.0.0" features = [ "macros", "rt-multi-thread", ] [dev-dependencies.wiremock] version = "0.6.0" reqwest-middleware-0.4.2/Cargo.toml.orig000064400000000000000000000020271046102023000163240ustar 00000000000000[package] name = "reqwest-middleware" version = "0.4.2" authors = ["Rodrigo Gryzinski "] edition = "2018" description = "Wrapper around reqwest to allow for client middleware chains." repository = "https://github.com/TrueLayer/reqwest-middleware" license = "MIT OR Apache-2.0" keywords = ["reqwest", "http", "middleware"] categories = ["web-programming::http-client"] readme = "../README.md" [features] multipart = ["reqwest/multipart"] json = ["reqwest/json"] charset = ["reqwest/charset"] http2 = ["reqwest/http2"] rustls-tls = ["reqwest/rustls-tls"] [dependencies] anyhow = "1.0.0" async-trait = "0.1.51" http = "1.0.0" reqwest = { version = "0.12.0", default-features = false } serde = "1.0.106" thiserror = "1.0.21" tower-service = "0.3.0" [dev-dependencies] reqwest = { version = "0.12.0", features = ["rustls-tls"] } reqwest-retry = { path = "../reqwest-retry" } reqwest-tracing = { path = "../reqwest-tracing" } tokio = { version = "1.0.0", features = ["macros", "rt-multi-thread"] } wiremock = "0.6.0" reqwest-middleware-0.4.2/LICENSE-APACHE000064400000000000000000000227731046102023000153730ustar 00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS reqwest-middleware-0.4.2/LICENSE-MIT000064400000000000000000000020521046102023000150670ustar 00000000000000MIT License Copyright (c) 2021 TrueLayer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. reqwest-middleware-0.4.2/README.md000064400000000000000000000075761046102023000147320ustar 00000000000000# reqwest-middleware A crate implementing a wrapper around [reqwest](https://crates.io/crates/reqwest) to allow for client middleware chains. [![Crates.io](https://img.shields.io/crates/v/reqwest-middleware.svg)](https://crates.io/crates/reqwest-middleware) [![Docs.rs](https://docs.rs/reqwest-middleware/badge.svg)](https://docs.rs/reqwest-middleware) [![CI](https://github.com/TrueLayer/reqwest-middleware/workflows/CI/badge.svg)](https://github.com/TrueLayer/reqwest-middleware/actions) [![Coverage Status](https://coveralls.io/repos/github/TrueLayer/reqwest-middleware/badge.svg?branch=main&t=YKhONc)](https://coveralls.io/github/TrueLayer/reqwest-middleware?branch=main) This crate provides functionality for building and running middleware but no middleware implementations. This repository also contains a couple of useful concrete middleware crates: * [`reqwest-retry`](https://crates.io/crates/reqwest-retry): retry failed requests. * [`reqwest-tracing`](https://crates.io/crates/reqwest-tracing): [`tracing`](https://crates.io/crates/tracing) integration, optional opentelemetry support. Note about browser support: automated tests targeting wasm are disabled. The crate may work with wasm but wasm support is unmaintained. PRs improving wasm are still welcome but you'd need to reintroduce the tests and get them passing before we'd merge it (see https://github.com/TrueLayer/reqwest-middleware/pull/105). ## Overview The `reqwest-middleware` client exposes the same interface as a plain `reqwest` client, but `ClientBuilder` exposes functionality to attach middleware: ```toml # Cargo.toml # ... [dependencies] reqwest = { version = "0.12", features = ["rustls-tls"] } reqwest-middleware = "0.4" reqwest-retry = "0.7" reqwest-tracing = "0.5" tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } ``` ```rust use reqwest_middleware::{ClientBuilder, ClientWithMiddleware}; use reqwest_retry::{RetryTransientMiddleware, policies::ExponentialBackoff}; use reqwest_tracing::TracingMiddleware; #[tokio::main] async fn main() { // Retry up to 3 times with increasing intervals between attempts. let retry_policy = ExponentialBackoff::builder().build_with_max_retries(3); let client = ClientBuilder::new(reqwest::Client::new()) // Trace HTTP requests. See the tracing crate to make use of these traces. .with(TracingMiddleware::default()) // Retry failed requests. .with(RetryTransientMiddleware::new_with_policy(retry_policy)) .build(); run(client).await; } async fn run(client: ClientWithMiddleware) { client .get("https://truelayer.com") .header("foo", "bar") .send() .await .unwrap(); } ``` #### License Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. ## Third-party middleware The following third-party middleware use `reqwest-middleware`: - [`reqwest-conditional-middleware`](https://github.com/oxidecomputer/reqwest-conditional-middleware) - Per-request basis middleware - [`http-cache`](https://github.com/06chaynes/http-cache) - HTTP caching rules - [`reqwest-cache`](https://gitlab.com/famedly/company/backend/libraries/reqwest-cache) - HTTP caching - [`aliri_reqwest`](https://github.com/neoeinstein/aliri/tree/main/aliri_reqwest) - Background token management and renewal - [`http-signature-normalization-reqwest`](https://crates.io/crates/http-signature-normalization-reqwest) (not free software) - HTTP Signatures - [`reqwest-chain`](https://github.com/tommilligan/reqwest-chain) - Apply custom criteria to any reqwest response, deciding when and how to retry. reqwest-middleware-0.4.2/src/client.rs000064400000000000000000000477721046102023000160700ustar 00000000000000use http::Extensions; use reqwest::header::{HeaderMap, HeaderName, HeaderValue}; use reqwest::{Body, Client, IntoUrl, Method, Request, Response}; use serde::Serialize; use std::convert::TryFrom; use std::fmt::{self, Display}; use std::sync::Arc; #[cfg(feature = "multipart")] use reqwest::multipart; use crate::error::Result; use crate::middleware::{Middleware, Next}; use crate::RequestInitialiser; /// A `ClientBuilder` is used to build a [`ClientWithMiddleware`]. /// /// [`ClientWithMiddleware`]: crate::ClientWithMiddleware pub struct ClientBuilder { client: Client, middleware_stack: Vec>, initialiser_stack: Vec>, } impl ClientBuilder { pub fn new(client: Client) -> Self { ClientBuilder { client, middleware_stack: Vec::new(), initialiser_stack: Vec::new(), } } /// This method allows creating a ClientBuilder /// from an existing ClientWithMiddleware instance pub fn from_client(client_with_middleware: ClientWithMiddleware) -> Self { Self { client: client_with_middleware.inner, middleware_stack: client_with_middleware.middleware_stack.into_vec(), initialiser_stack: client_with_middleware.initialiser_stack.into_vec(), } } /// Convenience method to attach middleware. /// /// If you need to keep a reference to the middleware after attaching, use [`with_arc`]. /// /// [`with_arc`]: Self::with_arc pub fn with(self, middleware: M) -> Self where M: Middleware, { self.with_arc(Arc::new(middleware)) } /// Add middleware to the chain. [`with`] is more ergonomic if you don't need the `Arc`. /// /// [`with`]: Self::with pub fn with_arc(mut self, middleware: Arc) -> Self { self.middleware_stack.push(middleware); self } /// Convenience method to attach a request initialiser. /// /// If you need to keep a reference to the initialiser after attaching, use [`with_arc_init`]. /// /// [`with_arc_init`]: Self::with_arc_init pub fn with_init(self, initialiser: I) -> Self where I: RequestInitialiser, { self.with_arc_init(Arc::new(initialiser)) } /// Add a request initialiser to the chain. [`with_init`] is more ergonomic if you don't need the `Arc`. /// /// [`with_init`]: Self::with_init pub fn with_arc_init(mut self, initialiser: Arc) -> Self { self.initialiser_stack.push(initialiser); self } /// Returns a `ClientWithMiddleware` using this builder configuration. pub fn build(self) -> ClientWithMiddleware { ClientWithMiddleware { inner: self.client, middleware_stack: self.middleware_stack.into_boxed_slice(), initialiser_stack: self.initialiser_stack.into_boxed_slice(), } } } /// `ClientWithMiddleware` is a wrapper around [`reqwest::Client`] which runs middleware on every /// request. #[derive(Clone, Default)] pub struct ClientWithMiddleware { inner: reqwest::Client, middleware_stack: Box<[Arc]>, initialiser_stack: Box<[Arc]>, } impl ClientWithMiddleware { /// See [`ClientBuilder`] for a more ergonomic way to build `ClientWithMiddleware` instances. pub fn new(client: Client, middleware_stack: T) -> Self where T: Into]>>, { ClientWithMiddleware { inner: client, middleware_stack: middleware_stack.into(), // TODO(conradludgate) - allow downstream code to control this manually if desired initialiser_stack: Box::new([]), } } /// Convenience method to make a `GET` request to a URL. /// /// # Errors /// /// This method fails whenever the supplied `Url` cannot be parsed. pub fn get(&self, url: U) -> RequestBuilder { self.request(Method::GET, url) } /// Convenience method to make a `POST` request to a URL. /// /// # Errors /// /// This method fails whenever the supplied `Url` cannot be parsed. pub fn post(&self, url: U) -> RequestBuilder { self.request(Method::POST, url) } /// Convenience method to make a `PUT` request to a URL. /// /// # Errors /// /// This method fails whenever the supplied `Url` cannot be parsed. pub fn put(&self, url: U) -> RequestBuilder { self.request(Method::PUT, url) } /// Convenience method to make a `PATCH` request to a URL. /// /// # Errors /// /// This method fails whenever the supplied `Url` cannot be parsed. pub fn patch(&self, url: U) -> RequestBuilder { self.request(Method::PATCH, url) } /// Convenience method to make a `DELETE` request to a URL. /// /// # Errors /// /// This method fails whenever the supplied `Url` cannot be parsed. pub fn delete(&self, url: U) -> RequestBuilder { self.request(Method::DELETE, url) } /// Convenience method to make a `HEAD` request to a URL. /// /// # Errors /// /// This method fails whenever the supplied `Url` cannot be parsed. pub fn head(&self, url: U) -> RequestBuilder { self.request(Method::HEAD, url) } /// Start building a `Request` with the `Method` and `Url`. /// /// Returns a `RequestBuilder`, which will allow setting headers and /// the request body before sending. /// /// # Errors /// /// This method fails whenever the supplied `Url` cannot be parsed. pub fn request(&self, method: Method, url: U) -> RequestBuilder { let req = RequestBuilder { inner: self.inner.request(method, url), extensions: Extensions::new(), middleware_stack: self.middleware_stack.clone(), initialiser_stack: self.initialiser_stack.clone(), }; self.initialiser_stack .iter() .fold(req, |req, i| i.init(req)) } /// Executes a `Request`. /// /// A `Request` can be built manually with `Request::new()` or obtained /// from a RequestBuilder with `RequestBuilder::build()`. /// /// You should prefer to use the `RequestBuilder` and /// `RequestBuilder::send()`. /// /// # Errors /// /// This method fails if there was an error while sending request, /// redirect loop was detected or redirect limit was exhausted. pub async fn execute(&self, req: Request) -> Result { let mut ext = Extensions::new(); self.execute_with_extensions(req, &mut ext).await } /// Executes a `Request` with initial [`Extensions`]. /// /// A `Request` can be built manually with `Request::new()` or obtained /// from a RequestBuilder with `RequestBuilder::build()`. /// /// You should prefer to use the `RequestBuilder` and /// `RequestBuilder::send()`. /// /// # Errors /// /// This method fails if there was an error while sending request, /// redirect loop was detected or redirect limit was exhausted. pub async fn execute_with_extensions( &self, req: Request, ext: &mut Extensions, ) -> Result { let next = Next::new(&self.inner, &self.middleware_stack); next.run(req, ext).await } } /// Create a `ClientWithMiddleware` without any middleware. impl From for ClientWithMiddleware { fn from(client: Client) -> Self { ClientWithMiddleware { inner: client, middleware_stack: Box::new([]), initialiser_stack: Box::new([]), } } } impl fmt::Debug for ClientWithMiddleware { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { // skipping middleware_stack field for now f.debug_struct("ClientWithMiddleware") .field("inner", &self.inner) .finish_non_exhaustive() } } #[cfg(not(target_arch = "wasm32"))] mod service { use std::{ future::Future, pin::Pin, task::{Context, Poll}, }; use crate::Result; use http::Extensions; use reqwest::{Request, Response}; use crate::{middleware::BoxFuture, ClientWithMiddleware, Next}; // this is meant to be semi-private, same as reqwest's pending pub struct Pending { inner: BoxFuture<'static, Result>, } impl Unpin for Pending {} impl Future for Pending { type Output = Result; fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { self.inner.as_mut().poll(cx) } } impl tower_service::Service for ClientWithMiddleware { type Response = Response; type Error = crate::Error; type Future = Pending; fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { self.inner.poll_ready(cx).map_err(crate::Error::Reqwest) } fn call(&mut self, req: Request) -> Self::Future { let inner = self.inner.clone(); let middlewares = self.middleware_stack.clone(); let mut extensions = Extensions::new(); Pending { inner: Box::pin(async move { let next = Next::new(&inner, &middlewares); next.run(req, &mut extensions).await }), } } } impl tower_service::Service for &'_ ClientWithMiddleware { type Response = Response; type Error = crate::Error; type Future = Pending; fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { (&self.inner).poll_ready(cx).map_err(crate::Error::Reqwest) } fn call(&mut self, req: Request) -> Self::Future { let inner = self.inner.clone(); let middlewares = self.middleware_stack.clone(); let mut extensions = Extensions::new(); Pending { inner: Box::pin(async move { let next = Next::new(&inner, &middlewares); next.run(req, &mut extensions).await }), } } } } /// This is a wrapper around [`reqwest::RequestBuilder`] exposing the same API. #[must_use = "RequestBuilder does nothing until you 'send' it"] pub struct RequestBuilder { inner: reqwest::RequestBuilder, middleware_stack: Box<[Arc]>, initialiser_stack: Box<[Arc]>, extensions: Extensions, } impl RequestBuilder { /// Assemble a builder starting from an existing `Client` and a `Request`. pub fn from_parts(client: ClientWithMiddleware, request: Request) -> RequestBuilder { let inner = reqwest::RequestBuilder::from_parts(client.inner, request); RequestBuilder { inner, middleware_stack: client.middleware_stack, initialiser_stack: client.initialiser_stack, extensions: Extensions::new(), } } /// Add a `Header` to this Request. pub fn header(self, key: K, value: V) -> Self where HeaderName: TryFrom, >::Error: Into, HeaderValue: TryFrom, >::Error: Into, { RequestBuilder { inner: self.inner.header(key, value), ..self } } /// Add a set of Headers to the existing ones on this Request. /// /// The headers will be merged in to any already set. pub fn headers(self, headers: HeaderMap) -> Self { RequestBuilder { inner: self.inner.headers(headers), ..self } } #[cfg(not(target_arch = "wasm32"))] pub fn version(self, version: reqwest::Version) -> Self { RequestBuilder { inner: self.inner.version(version), ..self } } /// Enable HTTP basic authentication. /// /// ```rust /// # use anyhow::Error; /// /// # async fn run() -> Result<(), Error> { /// let client = reqwest_middleware::ClientWithMiddleware::from(reqwest::Client::new()); /// let resp = client.delete("http://httpbin.org/delete") /// .basic_auth("admin", Some("good password")) /// .send() /// .await?; /// # Ok(()) /// # } /// ``` pub fn basic_auth(self, username: U, password: Option

) -> Self where U: Display, P: Display, { RequestBuilder { inner: self.inner.basic_auth(username, password), ..self } } /// Enable HTTP bearer authentication. pub fn bearer_auth(self, token: T) -> Self where T: Display, { RequestBuilder { inner: self.inner.bearer_auth(token), ..self } } /// Set the request body. pub fn body>(self, body: T) -> Self { RequestBuilder { inner: self.inner.body(body), ..self } } /// Enables a request timeout. /// /// The timeout is applied from when the request starts connecting until the /// response body has finished. It affects only this request and overrides /// the timeout configured using `ClientBuilder::timeout()`. #[cfg(not(target_arch = "wasm32"))] pub fn timeout(self, timeout: std::time::Duration) -> Self { RequestBuilder { inner: self.inner.timeout(timeout), ..self } } #[cfg(feature = "multipart")] #[cfg_attr(docsrs, doc(cfg(feature = "multipart")))] pub fn multipart(self, multipart: multipart::Form) -> Self { RequestBuilder { inner: self.inner.multipart(multipart), ..self } } /// Modify the query string of the URL. /// /// Modifies the URL of this request, adding the parameters provided. /// This method appends and does not overwrite. This means that it can /// be called multiple times and that existing query parameters are not /// overwritten if the same key is used. The key will simply show up /// twice in the query string. /// Calling `.query(&[("foo", "a"), ("foo", "b")])` gives `"foo=a&foo=b"`. /// /// # Note /// This method does not support serializing a single key-value /// pair. Instead of using `.query(("key", "val"))`, use a sequence, such /// as `.query(&[("key", "val")])`. It's also possible to serialize structs /// and maps into a key-value pair. /// /// # Errors /// This method will fail if the object you provide cannot be serialized /// into a query string. pub fn query(self, query: &T) -> Self { RequestBuilder { inner: self.inner.query(query), ..self } } /// Send a form body. /// /// Sets the body to the url encoded serialization of the passed value, /// and also sets the `Content-Type: application/x-www-form-urlencoded` /// header. /// /// ```rust /// # use anyhow::Error; /// # use std::collections::HashMap; /// # /// # async fn run() -> Result<(), Error> { /// let mut params = HashMap::new(); /// params.insert("lang", "rust"); /// /// let client = reqwest_middleware::ClientWithMiddleware::from(reqwest::Client::new()); /// let res = client.post("http://httpbin.org") /// .form(¶ms) /// .send() /// .await?; /// # Ok(()) /// # } /// ``` /// /// # Errors /// /// This method fails if the passed value cannot be serialized into /// url encoded format pub fn form(self, form: &T) -> Self { RequestBuilder { inner: self.inner.form(form), ..self } } /// Send a JSON body. /// /// # Optional /// /// This requires the optional `json` feature enabled. /// /// # Errors /// /// Serialization can fail if `T`'s implementation of `Serialize` decides to /// fail, or if `T` contains a map with non-string keys. #[cfg(feature = "json")] #[cfg_attr(docsrs, doc(cfg(feature = "json")))] pub fn json(self, json: &T) -> Self { RequestBuilder { inner: self.inner.json(json), ..self } } /// Disable CORS on fetching the request. /// /// # WASM /// /// This option is only effective with WebAssembly target. /// /// The [request mode][mdn] will be set to 'no-cors'. /// /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/API/Request/mode #[deprecated(note = "Deprecated Upstream")] pub fn fetch_mode_no_cors(self) -> Self { RequestBuilder { inner: self.inner.fetch_mode_no_cors(), ..self } } /// Build a `Request`, which can be inspected, modified and executed with /// `ClientWithMiddleware::execute()`. pub fn build(self) -> reqwest::Result { self.inner.build() } /// Build a `Request`, which can be inspected, modified and executed with /// `ClientWithMiddleware::execute()`. /// /// This is similar to [`RequestBuilder::build()`], but also returns the /// embedded `Client`. pub fn build_split(self) -> (ClientWithMiddleware, reqwest::Result) { let Self { inner, middleware_stack, initialiser_stack, .. } = self; let (inner, req) = inner.build_split(); let client = ClientWithMiddleware { inner, middleware_stack, initialiser_stack, }; (client, req) } /// Inserts the extension into this request builder pub fn with_extension(mut self, extension: T) -> Self { self.extensions.insert(extension); self } /// Returns a mutable reference to the internal set of extensions for this request pub fn extensions(&mut self) -> &mut Extensions { &mut self.extensions } /// Constructs the Request and sends it to the target URL, returning a /// future Response. /// /// # Errors /// /// This method fails if there was an error while sending request, /// redirect loop was detected or redirect limit was exhausted. /// /// # Example /// /// ```no_run /// # use anyhow::Error; /// # /// # async fn run() -> Result<(), Error> { /// let response = reqwest_middleware::ClientWithMiddleware::from(reqwest::Client::new()) /// .get("https://hyper.rs") /// .send() /// .await?; /// # Ok(()) /// # } /// ``` pub async fn send(mut self) -> Result { let mut extensions = std::mem::take(self.extensions()); let (client, req) = self.build_split(); client.execute_with_extensions(req?, &mut extensions).await } /// Attempt to clone the RequestBuilder. /// /// `None` is returned if the RequestBuilder can not be cloned, /// i.e. if the request body is a stream. /// /// # Examples /// /// ``` /// # use reqwest::Error; /// # /// # fn run() -> Result<(), Error> { /// let client = reqwest_middleware::ClientWithMiddleware::from(reqwest::Client::new()); /// let builder = client.post("http://httpbin.org/post") /// .body("from a &str!"); /// let clone = builder.try_clone(); /// assert!(clone.is_some()); /// # Ok(()) /// # } /// ``` pub fn try_clone(&self) -> Option { self.inner.try_clone().map(|inner| RequestBuilder { inner, middleware_stack: self.middleware_stack.clone(), initialiser_stack: self.initialiser_stack.clone(), extensions: self.extensions.clone(), }) } } impl fmt::Debug for RequestBuilder { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { // skipping middleware_stack field for now f.debug_struct("RequestBuilder") .field("inner", &self.inner) .finish_non_exhaustive() } } reqwest-middleware-0.4.2/src/error.rs000064400000000000000000000100211046102023000157140ustar 00000000000000use reqwest::{StatusCode, Url}; use thiserror::Error; pub type Result = std::result::Result; #[derive(Error, Debug)] pub enum Error { /// There was an error running some middleware #[error(transparent)] Middleware(#[from] anyhow::Error), /// Error from the underlying reqwest client #[error(transparent)] Reqwest(#[from] reqwest::Error), } impl Error { pub fn middleware(err: E) -> Self where E: 'static + Send + Sync + std::error::Error, { Error::Middleware(err.into()) } /// Returns a possible URL related to this error. pub fn url(&self) -> Option<&Url> { match self { Error::Middleware(_) => None, Error::Reqwest(e) => e.url(), } } /// Returns a mutable reference to the URL related to this error. /// /// This is useful if you need to remove sensitive information from the URL /// (e.g. an API key in the query), but do not want to remove the URL /// entirely. pub fn url_mut(&mut self) -> Option<&mut Url> { match self { Error::Middleware(_) => None, Error::Reqwest(e) => e.url_mut(), } } /// Adds a url related to this error (overwriting any existing). pub fn with_url(self, url: Url) -> Self { match self { Error::Middleware(_) => self, Error::Reqwest(e) => e.with_url(url).into(), } } /// Strips the related URL from this error (if, for example, it contains /// sensitive information). pub fn without_url(self) -> Self { match self { Error::Middleware(_) => self, Error::Reqwest(e) => e.without_url().into(), } } /// Returns true if the error is from any middleware. pub fn is_middleware(&self) -> bool { match self { Error::Middleware(_) => true, Error::Reqwest(_) => false, } } /// Returns true if the error is from a type `Builder`. pub fn is_builder(&self) -> bool { match self { Error::Middleware(_) => false, Error::Reqwest(e) => e.is_builder(), } } /// Returns true if the error is from a `RedirectPolicy`. pub fn is_redirect(&self) -> bool { match self { Error::Middleware(_) => false, Error::Reqwest(e) => e.is_redirect(), } } /// Returns true if the error is from `Response::error_for_status`. pub fn is_status(&self) -> bool { match self { Error::Middleware(_) => false, Error::Reqwest(e) => e.is_status(), } } /// Returns true if the error is related to a timeout. pub fn is_timeout(&self) -> bool { match self { Error::Middleware(_) => false, Error::Reqwest(e) => e.is_timeout(), } } /// Returns true if the error is related to the request. pub fn is_request(&self) -> bool { match self { Error::Middleware(_) => false, Error::Reqwest(e) => e.is_request(), } } #[cfg(not(target_arch = "wasm32"))] /// Returns true if the error is related to connect. pub fn is_connect(&self) -> bool { match self { Error::Middleware(_) => false, Error::Reqwest(e) => e.is_connect(), } } /// Returns true if the error is related to the request or response body. pub fn is_body(&self) -> bool { match self { Error::Middleware(_) => false, Error::Reqwest(e) => e.is_body(), } } /// Returns true if the error is related to decoding the response's body. pub fn is_decode(&self) -> bool { match self { Error::Middleware(_) => false, Error::Reqwest(e) => e.is_decode(), } } /// Returns the status code, if the error was generated from a response. pub fn status(&self) -> Option { match self { Error::Middleware(_) => None, Error::Reqwest(e) => e.status(), } } } reqwest-middleware-0.4.2/src/lib.rs000064400000000000000000000040161046102023000153400ustar 00000000000000//! This crate provides [`ClientWithMiddleware`], a wrapper around [`reqwest::Client`] with the //! ability to attach middleware which runs on every request. //! //! You'll want to instantiate [`ClientWithMiddleware`] using [`ClientBuilder`], then you can //! attach your middleware using [`with`], finalize it with [`build`] and from then on sending //! requests is the same as with reqwest: //! //! ``` //! use reqwest::{Client, Request, Response}; //! use reqwest_middleware::{ClientBuilder, Middleware, Next, Result}; //! use http::Extensions; //! //! struct LoggingMiddleware; //! //! #[async_trait::async_trait] //! impl Middleware for LoggingMiddleware { //! async fn handle( //! &self, //! req: Request, //! extensions: &mut Extensions, //! next: Next<'_>, //! ) -> Result { //! println!("Request started {:?}", req); //! let res = next.run(req, extensions).await; //! println!("Result: {:?}", res); //! res //! } //! } //! //! async fn run() { //! let reqwest_client = Client::builder().build().unwrap(); //! let client = ClientBuilder::new(reqwest_client) //! .with(LoggingMiddleware) //! .build(); //! let resp = client.get("https://truelayer.com").send().await.unwrap(); //! println!("TrueLayer page HTML: {}", resp.text().await.unwrap()); //! } //! ``` //! //! [`build`]: ClientBuilder::build //! [`ClientBuilder`]: ClientBuilder //! [`ClientWithMiddleware`]: ClientWithMiddleware //! [`with`]: ClientBuilder::with // Test README examples without overriding module docs. // We want to keep the in-code docs separate as those allow for automatic linking to crate // documentation. #[doc = include_str!("../../README.md")] #[cfg(doctest)] pub struct ReadmeDoctests; mod client; mod error; mod middleware; mod req_init; pub use client::{ClientBuilder, ClientWithMiddleware, RequestBuilder}; pub use error::{Error, Result}; pub use middleware::{Middleware, Next}; pub use req_init::{Extension, RequestInitialiser}; pub use reqwest; reqwest-middleware-0.4.2/src/middleware.rs000064400000000000000000000062541046102023000167150ustar 00000000000000use http::Extensions; use reqwest::{Client, Request, Response}; use crate::error::{Error, Result}; use std::sync::Arc; /// When attached to a [`ClientWithMiddleware`] (generally using [`with`]), middleware is run /// whenever the client issues a request, in the order it was attached. /// /// # Example /// /// ``` /// use reqwest::{Client, Request, Response}; /// use reqwest_middleware::{ClientBuilder, Middleware, Next, Result}; /// use http::Extensions; /// /// struct TransparentMiddleware; /// /// #[async_trait::async_trait] /// impl Middleware for TransparentMiddleware { /// async fn handle( /// &self, /// req: Request, /// extensions: &mut Extensions, /// next: Next<'_>, /// ) -> Result { /// next.run(req, extensions).await /// } /// } /// ``` /// /// [`ClientWithMiddleware`]: crate::ClientWithMiddleware /// [`with`]: crate::ClientBuilder::with #[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)] #[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))] pub trait Middleware: 'static + Send + Sync { /// Invoked with a request before sending it. If you want to continue processing the request, /// you should explicitly call `next.run(req, extensions)`. /// /// If you need to forward data down the middleware stack, you can use the `extensions` /// argument. async fn handle( &self, req: Request, extensions: &mut Extensions, next: Next<'_>, ) -> Result; } #[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)] #[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))] impl Middleware for F where F: Send + Sync + 'static + for<'a> Fn(Request, &'a mut Extensions, Next<'a>) -> BoxFuture<'a, Result>, { async fn handle( &self, req: Request, extensions: &mut Extensions, next: Next<'_>, ) -> Result { (self)(req, extensions, next).await } } /// Next encapsulates the remaining middleware chain to run in [`Middleware::handle`]. You can /// forward the request down the chain with [`run`]. /// /// [`Middleware::handle`]: Middleware::handle /// [`run`]: Self::run #[derive(Clone)] pub struct Next<'a> { client: &'a Client, middlewares: &'a [Arc], } #[cfg(not(target_arch = "wasm32"))] pub type BoxFuture<'a, T> = std::pin::Pin + Send + 'a>>; #[cfg(target_arch = "wasm32")] pub type BoxFuture<'a, T> = std::pin::Pin + 'a>>; impl<'a> Next<'a> { pub(crate) fn new(client: &'a Client, middlewares: &'a [Arc]) -> Self { Next { client, middlewares, } } pub fn run( mut self, req: Request, extensions: &'a mut Extensions, ) -> BoxFuture<'a, Result> { if let Some((current, rest)) = self.middlewares.split_first() { self.middlewares = rest; current.handle(req, extensions, self) } else { Box::pin(async move { self.client.execute(req).await.map_err(Error::from) }) } } } reqwest-middleware-0.4.2/src/req_init.rs000064400000000000000000000051361046102023000164100ustar 00000000000000use crate::RequestBuilder; /// When attached to a [`ClientWithMiddleware`] (generally using [`with_init`]), it is run /// whenever the client starts building a request, in the order it was attached. /// /// # Example /// /// ``` /// use reqwest_middleware::{RequestInitialiser, RequestBuilder}; /// /// struct AuthInit; /// /// impl RequestInitialiser for AuthInit { /// fn init(&self, req: RequestBuilder) -> RequestBuilder { /// req.bearer_auth("my_auth_token") /// } /// } /// ``` /// /// [`ClientWithMiddleware`]: crate::ClientWithMiddleware /// [`with_init`]: crate::ClientBuilder::with_init pub trait RequestInitialiser: 'static + Send + Sync { fn init(&self, req: RequestBuilder) -> RequestBuilder; } impl RequestInitialiser for F where F: Send + Sync + 'static + Fn(RequestBuilder) -> RequestBuilder, { fn init(&self, req: RequestBuilder) -> RequestBuilder { (self)(req) } } /// A middleware that inserts the value into the [`Extensions`](http::Extensions) during the call. /// /// This is a good way to inject extensions to middleware deeper in the stack /// /// ``` /// use reqwest::{Client, Request, Response}; /// use reqwest_middleware::{ClientBuilder, Middleware, Next, Result, Extension}; /// use http::Extensions; /// /// #[derive(Clone)] /// struct LogName(&'static str); /// struct LoggingMiddleware; /// /// #[async_trait::async_trait] /// impl Middleware for LoggingMiddleware { /// async fn handle( /// &self, /// req: Request, /// extensions: &mut Extensions, /// next: Next<'_>, /// ) -> Result { /// // get the log name or default to "unknown" /// let name = extensions /// .get() /// .map(|&LogName(name)| name) /// .unwrap_or("unknown"); /// println!("[{name}] Request started {req:?}"); /// let res = next.run(req, extensions).await; /// println!("[{name}] Result: {res:?}"); /// res /// } /// } /// /// async fn run() { /// let reqwest_client = Client::builder().build().unwrap(); /// let client = ClientBuilder::new(reqwest_client) /// .with_init(Extension(LogName("my-client"))) /// .with(LoggingMiddleware) /// .build(); /// let resp = client.get("https://truelayer.com").send().await.unwrap(); /// println!("TrueLayer page HTML: {}", resp.text().await.unwrap()); /// } /// ``` pub struct Extension(pub T); impl RequestInitialiser for Extension { fn init(&self, req: RequestBuilder) -> RequestBuilder { req.with_extension(self.0.clone()) } }