Closed kingledion closed 1 year ago
Um.. I feel this is due to a required feature in hyper, I'll look into this when I got time.
The fundamental problem for me is that I have done all this work and can't get an example working! Do you have any working example code that I can check out?
The example you have written works when you have either tls feature enabled
reqwest-native-tls = ["reqwest", "reqwest/native-tls"]
reqwest-rustls-tls = ["reqwest", "reqwest/rustls-tls"]
println!("Started test");
let api_token = "mytoken";
println!("Loaded env variable");
let client = PostmarkClient::builder().token(api_token).build();
println!("Created client");
let req = CreateTemplateRequest::builder()
.name("Hello")
.body(Body::html("This is a basic e-mail test!".into()))
.build();
println!("Created Template \"Hello\"");
let resp = req.execute(&client).await;
resp.unwrap();
I've added it to the test dependencies https://github.com/pastjean/postmark-rs/commit/641660a965144476d8da220dddfc1021f47a3344
This solved my issue, thank you for pointing this out to me.
I'm opening this issue because I ran into some trouble with manual testing. When I went to test my template changes against the API, using the skipped test, I have been hitting snags with sending any sort of request to the Postmark API.
The manual test in this branch can be run with cargo test --test send_email. I made the test match what is in the package docstrings pretty closely.
The error I am getting back from the .execute() call is:
The error message
invalid URL, scheme is not http
can be traced to here:https://docs.rs/hyper/latest/src/hyper/client/connect/http.rs.html#285
This error will throw when the scheme is https. I'm not sure what is going on in the middle with reqwest and why it is expecting http, but it should pretty clearly be https to communicate with Postmark.