http-rs / http-rs/http-types

Return `Result` from constructors which take `TryInto<Url>`

Open
#303 2 comments 0 reactions 0 assignees View on GitHub
semver-major
Dominant language
Rust
Stars
209
Forks
91
PR merge metrics
No merged PRs in 30d

Description

Now that `TryFrom for Url` has been implemented, using the `Url` struct is a lot more pleasant. This opens up the possibility again for us to move from a "panic if parsing fails" to returning errors if parsing fails.

```rust
// current, panic if the url is malformed
let req = Request::post("https://api.foo.com/berries");

// proposed, throw an error instead
let req = Request::post("https://api.foo.com/berries")?;
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.