doc fixes
This commit is contained in:
13
src/lib.rs
13
src/lib.rs
@@ -32,15 +32,18 @@
|
||||
//! [`ureq::put`](fn.put.html), etc).
|
||||
//!
|
||||
//! These top level http method functions create a [Request](struct.Request.html) instance
|
||||
//! which follows a build pattern. The builders are finished using
|
||||
//! [`.call()`](struct.Request.html#method.call),
|
||||
//! [`.send_string()`](struct.Request.html#method.send_string) or
|
||||
//! [`.send_json()`](struct.Request.html#method.send_json).
|
||||
//! which follows a build pattern. The builders are finished using:
|
||||
//!
|
||||
//! * [`.call()`](struct.Request.html#method.call) without a request body.
|
||||
//! * [`.send()`](struct.Request.html#method.send) with a request body as `Read`.
|
||||
//! * [`.send_string()`](struct.Request.html#method.send_string) body as string.
|
||||
//! * [`.send_json()`](struct.Request.html#method.send_json) body as serde json.
|
||||
//!
|
||||
//! # Agents
|
||||
//!
|
||||
//! To maintain a state, cookies, between requests, you use an [agent](struct.Agent.html).
|
||||
//! Agents also follow the build pattern. Agents are created with `ureq::agent().build()`.
|
||||
//! Agents also follow the build pattern. Agents are created with
|
||||
//! [`ureq::agent().build()`](struct.Agent.html).
|
||||
//!
|
||||
//! # Content-Length
|
||||
//!
|
||||
|
||||
@@ -201,7 +201,16 @@ impl Request {
|
||||
///
|
||||
/// The `Content-Length` header is not set because we can't know the length of the reader.
|
||||
///
|
||||
/// ```
|
||||
/// use std::io::Cursor;
|
||||
///
|
||||
/// let text = "Hello there!\n";
|
||||
/// let read = Cursor::new(text.to_string().into_bytes());
|
||||
///
|
||||
/// let resp = ureq::post("/somewhere")
|
||||
/// .set("Content-Type", "text/plain")
|
||||
/// .send(read);
|
||||
/// ```
|
||||
pub fn send<R>(&mut self, reader: R) -> Response
|
||||
where
|
||||
R: Read + Send + 'static,
|
||||
|
||||
@@ -221,9 +221,9 @@ impl Response {
|
||||
|
||||
/// Turn this response into a `impl Read` of the body.
|
||||
///
|
||||
/// 1. If "Transfer-Encoding: chunked", the returned reader will unchunk it
|
||||
/// and any "Content-Length" header is ignored.
|
||||
/// 2. If "Content-Length" is set, the returned reader is limited to this byte
|
||||
/// 1. If `Transfer-Encoding: chunked`, the returned reader will unchunk it
|
||||
/// and any `Content-Length` header is ignored.
|
||||
/// 2. If `Content-Length` is set, the returned reader is limited to this byte
|
||||
/// length regardless of how many bytes the server sends.
|
||||
/// 3. If no length header, the reader is until server stream end.
|
||||
///
|
||||
@@ -263,7 +263,7 @@ impl Response {
|
||||
}
|
||||
|
||||
/// Turn this response into a String of the response body. Attempts to respect the
|
||||
/// character encoding of the "Content-Type" and falls back to `utf-8`.
|
||||
/// character encoding of the `Content-Type` header and falls back to `utf-8`.
|
||||
///
|
||||
/// This is potentially memory inefficient for large bodies since the
|
||||
/// implementation first reads the reader to end into a `Vec<u8>` and then
|
||||
|
||||
Reference in New Issue
Block a user