fix clippy lints
This commit is contained in:
committed by
Martin Algesten
parent
a6f64188dc
commit
4b9cfe2b67
26
src/lib.rs
26
src/lib.rs
@@ -8,22 +8,18 @@
|
||||
//!
|
||||
//! ```
|
||||
//! // requires feature: `ureq = { version = "*", features = ["json"] }`
|
||||
//! #[macro_use]
|
||||
//! extern crate ureq;
|
||||
//! use ureq::json;
|
||||
//! // sync post request of some json.
|
||||
//! let resp = ureq::post("https://myapi.acme.com/ingest")
|
||||
//! .set("X-My-Header", "Secret")
|
||||
//! .send_json(json!({
|
||||
//! "name": "martin",
|
||||
//! "rust": true
|
||||
//! }));
|
||||
//!
|
||||
//! fn main() {
|
||||
//! // sync post request of some json.
|
||||
//! let resp = ureq::post("https://myapi.acme.com/ingest")
|
||||
//! .set("X-My-Header", "Secret")
|
||||
//! .send_json(json!({
|
||||
//! "name": "martin",
|
||||
//! "rust": true
|
||||
//! }));
|
||||
//!
|
||||
//! // .ok() tells if response is 200-299.
|
||||
//! if resp.ok() {
|
||||
//! // ....
|
||||
//! }
|
||||
//! // .ok() tells if response is 200-299.
|
||||
//! if resp.ok() {
|
||||
//! // ....
|
||||
//! }
|
||||
//! ```
|
||||
//!
|
||||
|
||||
@@ -140,15 +140,10 @@ impl Request {
|
||||
/// The `Content-Length` header is implicitly set to the length of the serialized value.
|
||||
///
|
||||
/// ```
|
||||
/// #[macro_use]
|
||||
/// extern crate ureq;
|
||||
///
|
||||
/// fn main() {
|
||||
/// let body = b"Hello world!";
|
||||
/// let r = ureq::post("/my_page")
|
||||
/// .send_bytes(body);
|
||||
/// println!("{:?}", r);
|
||||
/// }
|
||||
/// ```
|
||||
pub fn send_bytes(&mut self, data: &[u8]) -> Response {
|
||||
self.do_call(Payload::Bytes(data.to_owned()))
|
||||
|
||||
@@ -338,7 +338,7 @@ fn save_cookies(unit: &Unit, resp: &Response) {
|
||||
if let Some(add_jar) = state.as_mut().map(|state| &mut state.jar) {
|
||||
for raw_cookie in cookies.iter() {
|
||||
let to_parse = if raw_cookie.to_lowercase().contains("domain=") {
|
||||
raw_cookie.to_string()
|
||||
(*raw_cookie).to_string()
|
||||
} else {
|
||||
let host = &unit.url.host_str().unwrap_or(DEFAULT_HOST).to_string();
|
||||
format!("{}; Domain={}", raw_cookie, host)
|
||||
|
||||
Reference in New Issue
Block a user