-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit Implements and leverages new `T: Into<Cookie>` `impl`s to simplify the creation of and reference to cookies across the crate. Specifically, it adds implementations of `Into<Cookie>` for string-like types (`&str`, `String`, `Cow<str>`), tuples of string-like types `(name string, value string)`, and `CookieBuilder`. The former implementations create a cookie with a name corresponding to the string and an empty value. The tuple implementation creates a cookie with the given name and value strings. The `CookieBuilder` implementation simply unwraps the in-process cookie. Functions and methods that previously accepted a `Cookie` now accept any `T: Into<Cookie>`. This particularly affects the `CookieJar` API, which now allows simpler addition and removal of cookies: * `jar.add(("foo", "bar"));` * `jar.add(Cookie::build(("foo", "bar")).path("/"));` * `jar.remove("foo");` * `jar.remove(Cookie::build("foo").path("/"));` Additionally, as noted above, the `Into<Cookie>` `impl` for `CookieBuilder` obviates most explicit calls to `CookieBuilder::finish()` (now `build()`). Resolves #199.
- Loading branch information
1 parent
8a1ec74
commit 49ff7b0
Showing
9 changed files
with
447 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.