When I call a GitHub API endpoint using octorust, I want to be able to extract the URL and request headers that octorust used for the request.
In reqwest, you can use http::Extensions (https://docs.rs/http/latest/http/struct.Extensions.html) to attach additional data to requests and responses in middleware.
I use this in order to extract the GitHub API URL and request headers that octorust uses in its requests.
In order to access the inserted "extensions", I made a small patch for octorust that adds an extensions field to octorust::Response. In the patch, I populate this field by copying the data from reqwest::Response::extensions(). In this way, you can then use http::Extensions in middleware in code that makes use of octorust.
I am making this issue to describe the motivation for my patch, and I will be opening a PR with the patch.
When I call a GitHub API endpoint using
octorust, I want to be able to extract the URL and request headers thatoctorustused for the request.In reqwest, you can use
http::Extensions(https://docs.rs/http/latest/http/struct.Extensions.html) to attach additional data to requests and responses in middleware.I use this in order to extract the GitHub API URL and request headers that
octorustuses in its requests.In order to access the inserted "extensions", I made a small patch for
octorustthat adds anextensionsfield tooctorust::Response. In the patch, I populate this field by copying the data fromreqwest::Response::extensions(). In this way, you can then usehttp::Extensionsin middleware in code that makes use ofoctorust.I am making this issue to describe the motivation for my patch, and I will be opening a PR with the patch.