Skip to content

Add send method to Response<Fresh> #446

@seanmonstar

Description

@seanmonstar

This method would be a guaranteed single write, so we could set the Content-Length header, write the body, and then end() the request.

Basically:

impl Response<Fresh> {
    fn send(self, buf: &[u8]) -> io::Result<usize> {
        self.headers.set(ContentLength(buf.len()));
        try!(self.body.write_all(buf));
        self.end();
        Ok(buf.len())
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-serverArea: server.E-easyEffort: easy. A task that would be a great starting point for a new contributor.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions