1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
pub use tiny_http::Request as TinyHttpRequest;
use super::HttpRequest;
use std::io::Read;
impl<'r> HttpRequest for &'r mut TinyHttpRequest {
type Body = &'r mut Read;
fn multipart_boundary(&self) -> Option<&str> {
const BOUNDARY: &'static str = "boundary=";
let content_type = try_opt!(self.headers().iter().find(|header| header.field.equiv("Content-Type"))).value.as_str();
let start = try_opt!(content_type.find(BOUNDARY)) + BOUNDARY.len();
let end = content_type[start..].find(';').map_or(content_type.len(), |end| start + end);
Some(&content_type[start .. end])
}
fn body(self) -> Self::Body {
self.as_reader()
}
}