oxidecomputer / oxidecomputer/third-party-api-clients

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

Open
#97 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
150
Forks
62
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at octorust::Response and the reqwest::Response::extensions() API described in the issue, then trace where responses are constructed. Done when callers can access the relevant request URL and headers through the exposed response extensions, with tests covering that propagation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.