Commit Graph

21 Commits

Author SHA1 Message Date
Christoph Herzog
954fdfae30 Implement cookie store support
This commit introduces a cookie store / session support
for both the async and the sync client.

Functionality is based on the cookie crate,
which provides a HTTP cookie abstraction,
and the cookie_store crate which provides a
store that handles cookie storage and url/expiration
based cookie resolution for requests.

Changes:
* adds new private dependencies: time, cookie, cookie_store
* a new cookie module which provides wrapper types around
    the dependency crates
* a Response::cookies() accessor for iterating over response cookies
* a ClientBuilder::cookie_store() method that enables session functionality
* addition of a cookie_store member to the async client
* injecting request cookies and persisting response cookies
* cookie tests

NOTE: this commit DOES NOT expose the CookieStore itself,
limiting available functionality.

This is desirable, but omitted for now due to API considerations that should be fleshed out in the future.
This means users do not have direct access to the cookie session for now.
2019-04-09 12:54:10 -07:00
Michael Habib
e49f5ee404 add Response::error_for_status_ref to allow borrowing (#457) 2019-02-15 14:33:18 -08:00
Luca Bruno
5e38b419f0 async/reponse: return a impl Future on json() 2019-02-15 10:33:57 -08:00
Sean McArthur
68e98d54ea Add Response::content_length() method 2019-01-18 11:42:27 -08:00
Sean McArthur
478ef9bf15 add Response::remote_addr() method
The new `remote_addr` method returns an `Option<SocketAddr>`, which is
`Some` if the underlying transport uses socket addresses.

Closes #373
2018-10-26 14:23:33 -07:00
Yannick Heinrich
c4bf420021 Integrate helper functions inside corresponding structs 2018-10-05 11:19:52 -07:00
Yannick Heinrich
647f59756e Add missing pub(crate) statements. 2018-10-05 11:19:52 -07:00
Paul Woolcock
4857a5917d From<http::Response> for Response (#360)
This adds an implementation to convert a `Response` type from the `http`
crate to the `async_impl::Response` type. This is the first step to
allow us to convert `http::Response` objects to `request::Response`
objects

This also adds an extension trait for the `http::response::Builder`
type. The `http::Response` object does not provide a way to access the
"final" url that the response is derived from, so we can't easily
provide that in the `From<http::Response>` implementation. For users who
are manually constructing `http::Response` objects for use in tests,
etc, they can import this extension trait, which adds a `.url()` builder
method that will allow them to pass a `Url`, which we then convert to
our newtype'd Url and add to the `http::Response`'s `extensions`. Then,
when converting from `http::Response` to `async_impl::Response` we can
pull that value out of the `extensions` and use it to construct the
`async_impl::Response`

Closes #333
2018-10-04 17:38:26 -07:00
Sean McArthur
0735e586e5 reduce size of Response, async::Response, and async::Decoder 2018-09-19 15:23:01 -07:00
Sean McArthur
2f893718ba pub(crate)ify async::response module 2018-09-11 14:27:28 -07:00
Sean McArthur
b95de15587 change Response::version() to return Version by value 2018-09-11 14:22:21 -07:00
Sean McArthur
3fbda4fd49 remove unstable language and feature 2018-08-15 16:08:47 -07:00
Yash Srivastav
12cfbafc28 Add support for getting HTTP version of a response 2018-07-31 13:53:42 -07:00
Yash Srivastav
c417d6dab8 Upgrade hyper to 0.12
Closes #304
2018-07-05 10:03:31 -07:00
Christopher Vittal
8aaff6c326 Add into_body to async_impl::response::Response
Closes #200
2017-09-20 03:21:24 -04:00
Sean McArthur
390fc34148 wip 2017-09-04 13:11:20 -07:00
Ashley Mannix
2cb70c872a make body return borrowed decoder 2017-08-19 18:02:20 +10:00
Ashley Mannix
e2fa97254e support async gzip decoding 2017-08-18 19:43:06 +10:00
Sean McArthur
8719b3d540 add some traces for proxy 2017-08-17 10:01:18 -07:00
Tom Prince
855e6615eb Add error_for_status.
This makes it it easy to turn error responses into error
results.
2017-06-22 11:03:39 -07:00
Sean McArthur
665b4fe718 upgrade hyper to v0.11 2017-06-21 09:47:21 -07:00