diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/zero/response.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/zero/response.rb b/lib/zero/response.rb index 74b2e28..b8aeff0 100644 --- a/lib/zero/response.rb +++ b/lib/zero/response.rb @@ -35,7 +35,14 @@ module Zero # TODO Set content length, if not already set # TODO Set content type, if not already set - [@status, @header, @body] + [status, header, body] + end + + # Sets the content length header to the current length of the body + # Also creates one, if it does not exists + # + def content_length + header['Content-Length'] = body.join.bytesize end end |