Skip to content

Instantly share code, notes, and snippets.

@dharmatech
Created May 19, 2014 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dharmatech/17b062a144c5a50de0d2 to your computer and use it in GitHub Desktop.
Save dharmatech/17b062a144c5a50de0d2 to your computer and use it in GitHub Desktop.
fn handle_request(&self, _r: &Request, w: &mut ResponseWriter) {
w.headers.date = Some(time::now_utc());
w.headers.content_length = Some(14);
w.headers.content_type = Some(MediaType {
type_: StrBuf::from_str("text"),
subtype: StrBuf::from_str("plain"),
parameters: vec!((StrBuf::from_str("charset"), StrBuf::from_str("UTF-8")))
});
w.headers.server = Some(StrBuf::from_str("Example"));
w.write(bytes!("Hello, World!\n")).unwrap();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment