Closed johncantrell97 closed 5 months ago
Out of curiosity what do you need custom heeaders for?
Access to authenticated esplora servers. most public ones are heavily rate limited
Please rebase to pick up changes in #69 that fix CI.
rebased
@johncantrell97 thanks for your work on this. Our github rules also require commits be signed, can you amend/sign your commit?
@johncantrell97 hey can you rebase and rework this one now that #75 is merged? hopefully not a big change.
The update introduces the ability to handle custom HTTP headers across both asynchronous and blocking clients. This is achieved by adding a headers
field to the Builder
struct, allowing users to specify headers that are then applied to all requests. Additionally, the update includes error handling for invalid header names and values, and expands testing to cover the new functionality, ensuring that specified headers are correctly used in requests.
Files | Change Summary |
---|---|
src/async.rs , src/blocking.rs |
Added logic to include custom HTTP headers in requests by utilizing a HeaderMap in AsyncClient and a HashMap<String, String> in BlockingClient . |
src/lib.rs |
Introduced a headers field in the Builder struct for HTTP headers, methods to add headers, error variants for invalid headers, and expanded testing setup. |
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
src/lib.rs | 43 | 47 | 91.49% | ||
src/async.rs | 2 | 10 | 20.0% | ||
<!-- | Total: | 51 | 63 | 80.95% | --> |
Totals | |
---|---|
Change from base Build 8167199538: | -0.2% |
Covered Lines: | 959 |
Relevant Lines: | 1134 |
I've rebased this on lastest master changes and updated to work with minreq for blocking module and added a simple test with http headers. In the process of rebasing I also signed the commits so github will let us merge it. Note: minreq doesn't include any header key, value validation.
Technically an end-user could do this themselves because the builders support passing in pre-built ureq/reqwest clients but this makes it a bit easier for them.
Summary by CodeRabbit
Builder
struct for adding HTTP headers to requests.