Function finish [src]

Finish the body of a request. This notifies the server that you have no more data to send. Must be called after send.

Prototype

pub fn finish(req: *Request) FinishError!void

Parameters

req: *Request

Possible Errors

ConnectionResetByPeer WriteError
MessageNotCompleted
MessageTooLong WriteError
NotWriteable WriteError
UnexpectedWriteFailure WriteError

Source

pub fn finish(req: *Request) FinishError!void { switch (req.transfer_encoding) { .chunked => try req.connection.?.writer().writeAll("0\r\n\r\n"), .content_length => |len| if (len != 0) return error.MessageNotCompleted, .none => {}, } try req.connection.?.flush(); }