Skip to content

octorust: Getting the request URL and request headers that were used #97

@ctsrc

Description

@ctsrc

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions