mirror of
https://github.com/lloeki/nanoserve.git
synced 2025-12-06 03:04:39 +01:00
Compute response's Content-Length once
This commit is contained in:
parent
88d0824dc8
commit
ea6406f4b8
1 changed files with 2 additions and 2 deletions
|
|
@ -186,7 +186,7 @@ module NanoServe
|
|||
end
|
||||
|
||||
def body=(value)
|
||||
@body = value.tap { @content_length = body.bytes.count.to_s }
|
||||
@body = value.tap { @content_length = value.bytes.count.to_s }
|
||||
end
|
||||
|
||||
def to_s
|
||||
|
|
@ -216,7 +216,7 @@ module NanoServe
|
|||
end
|
||||
|
||||
def content_length
|
||||
@content_length ||= body.bytes.count.to_s
|
||||
@content_length || '0'
|
||||
end
|
||||
|
||||
def content_type
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue