Use &str instead of AsRef<str> to be consistent with the API
This commit is contained in:
@@ -197,18 +197,12 @@ impl Request {
|
|||||||
/// println!("{:?}", r);
|
/// println!("{:?}", r);
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn send_form<I, K, V>(&mut self, pairs: I) -> Response
|
pub fn send_form(&mut self, data: &[(&str, &str)]) -> Response {
|
||||||
where
|
|
||||||
I: IntoIterator,
|
|
||||||
I::Item: Borrow<(K, V)>,
|
|
||||||
K: AsRef<str>,
|
|
||||||
V: AsRef<str>,
|
|
||||||
{
|
|
||||||
if self.header("Content-Type").is_none() {
|
if self.header("Content-Type").is_none() {
|
||||||
self.set("Content-Type", "application/x-www-form-urlencoded");
|
self.set("Content-Type", "application/x-www-form-urlencoded");
|
||||||
}
|
}
|
||||||
let encoded = form_urlencoded::Serializer::new(String::new())
|
let encoded = form_urlencoded::Serializer::new(String::new())
|
||||||
.extend_pairs(pairs)
|
.extend_pairs(data)
|
||||||
.finish();
|
.finish();
|
||||||
self.do_call(Payload::Bytes(encoded.into_bytes()))
|
self.do_call(Payload::Bytes(encoded.into_bytes()))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user