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

allow customization in client #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Dev43
Copy link

@Dev43 Dev43 commented Sep 21, 2022

This PR allows for the customization of the reqwest client that the arweave struct uses. This way I can pass custom headers to all the requests in an easy manner such as this:

        let mut headers = header::HeaderMap::new();
        headers.insert(
            "X-Network",
            header::HeaderValue::from_static("arweave.testnet"),
        );
        let mut builder = Client::builder();
        builder = builder.default_headers(headers);

        let c = builder.build().unwrap();

        let r = c
            .get("http://localhost:1984/tx/ready_for_mining")
            .header("Content-Type", "application/x-www-form-urlencoded")
            .send()
            .await?
            .text()
            .await?;

Also added actual methods for last_tx and tx_anchor

Thanks for this lib :)

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.

None yet

1 participant