Skip to content

Commit

Permalink
feat(response): use BytesContainer for send
Browse files Browse the repository at this point in the history
  • Loading branch information
cburgdorf committed Aug 15, 2014
1 parent ccfd384 commit 109bcfe
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/response.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::io::{IoResult, File};
use std::io::util::copy;
use std::path::BytesContainer;
use http;
use time;
use mimes::get_media_type;
Expand All @@ -24,11 +25,11 @@ impl<'a, 'b> Response<'a, 'b> {
/// ```{rust,ignore}
/// response.send("hello world");
/// ```
pub fn send (&mut self, text: &str) {
pub fn send<T: BytesContainer> (&mut self, text: T) {
// TODO: This needs to be more sophisticated to return the correct headers
// not just "some headers" :)
Response::set_headers(self.origin);
let _ = self.origin.write(text.as_bytes());
let _ = self.origin.write(text.container_as_bytes());
}

/// sets the content type by it's short form.
Expand Down

0 comments on commit 109bcfe

Please sign in to comment.