Skip to content

Instantly share code, notes, and snippets.

@tailhook
Created January 2, 2016 23:54
Show Gist options
  • Select an option

  • Save tailhook/92f443a9a5d41bf65ab7 to your computer and use it in GitHub Desktop.

Select an option

Save tailhook/92f443a9a5d41bf65ab7 to your computer and use it in GitHub Desktop.
fn request_start(self, head: Head, resp: &mut Response, scope: &mut Scope<C>)
-> Option<Self>
{
res.status(hyper::status::StatusCode::Ok);
res.add_header(TransferEncoding(vec![Encoding::Chunked]).unwrap();
res.done_headers().unwrap();
self
}
fn request_chunk(self, chunk: &[u8], resp: &mut Response, scope: &mut Scope<C>)
-> Option<Self>
{
res.write_body(
format!("Received chunk of {} bytes\n", chunk.len()));
self
}
fn request_end(self, _response: &mut Response, _scope: &mut Scope<C>)
-> Option<Self>
{
res.done();
None
}
@yanns

yanns commented Mar 9, 2016

Copy link
Copy Markdown

should resp: &mut Response be res: &mut Response?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment