Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: custom headers #47

Merged
merged 12 commits into from
Feb 8, 2022
Merged

feat: custom headers #47

merged 12 commits into from
Feb 8, 2022

Conversation

miraclx
Copy link
Collaborator

@miraclx miraclx commented Feb 8, 2022

Alleviate JsonRpcClient instances from being generic over some AuthScheme and instead support custom HTTP Headers.

Before

let client = JsonRpcClient::connect("https://rpc.testnet.near.org/")
    .auth(auth::ApiKey::new("9046daf1-52f9-4705-8121-8790adfba489"));

Now;

  1. let client = JsonRpcClient::connect("https://rpc.testnet.near.org/")
        .header(auth::ApiKey::new("9046daf1-52f9-4705-8121-8790adfba489")?);
  2. let client = JsonRpcClient::connect("https://rpc.testnet.near.org/")
        .header(("User-Agent", "some-client/0.2.0"))?;

@miraclx miraclx merged commit e0fe18b into master Feb 8, 2022
@miraclx miraclx deleted the custom-headers branch February 8, 2022 12:26
@miraclx miraclx mentioned this pull request Feb 9, 2022
miraclx added a commit that referenced this pull request Feb 9, 2022
- Dropped generic authentication and added support for custom headers. <#47>
- Added the `sandbox_fast_forward` RPC Method. <#38>
- Upgraded `nearcore` crates to `v0.12.0` <#48>
- Executing the [examples](https://github.com/near/near-jsonrpc-client-rs/tree/master/examples) now allows custom RPC addr specification with interactive server selection. <b130118> <c5e938a>
- `JsonRpcClient::connect` is now generic over any url-like type. [`Url`](https://docs.rs/url/*/url/struct.Url.html), `&str`, `String` and `&String` are all supported. <#35>
- `JsonRpcClient` now defaults to the `Unauthenticated` state, easing a type specification pain point. <#36>
@frol frol mentioned this pull request Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant