Skip to content

reqwest basic auth fails but curl works #1660

Answered by nb-twy
nb-twy asked this question in Q&A
Discussion options

You must be logged in to vote

And just like that, my problem is solved!

I would never have thought to look there. Thanks!

So, just to round things out for anyone following along or who might find this in the future, here is what the working code looks like.

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let set = 1;
    let host = "https://nic.changeip.com/nic/update";
    let username = "my_username";
    let password = "my_password";
    let new_ip = String::from("new_ip_address");

    let client = reqwest::Client::builder()
        .http1_title_case_headers()
        .build()?;

    let res = client
        .get(host)
        .query(&[("set", set.to_string()), ("ip", new_ip)])
        

Replies: 5 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@seanmonstar
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by nb-twy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants