Struct minihttpse::Response [] [src]

pub struct Response { /* fields omitted */ }

http response object

Methods

impl Response
[src]

parse http response to Response object.

Examples

let s = "HTTP/1.1 200 OK\r\n\
        Content-Length: 3059\r\n\
        Server: GWS/2.0\r\n\
        Date: Sat, 11 Jan 2003 02:44:04 GMT\r\n\
        Content-Type: text/html\r\n\
        Cache-control: private\r\n\
        Set-Cookie: PREF=ID=73d4aef52e57bae9:TM=1042253044:LM=1042253044:S=SMCc_HRPCQiqyX9j; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com\r\n\
        Connection: keep-alive\r\n\
        \r\n\
        <html>hello</html>";
let res = Response::new(s.as_bytes().to_owned()).unwrap();
assert_eq!(res.reason(),"OK");
assert_eq!(res.status_code,200);
assert_eq!(res.headers.get("Server"),Some(&"GWS/2.0".to_owned()));
println!("body {}",res.text());

return status code(eg:200)

return response body string

return response raw body

return response headers hashmap

return response reason

Trait Implementations

impl Debug for Response
[src]

Formats the value using the given formatter.

impl Clone for Response
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more