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
|
end
|
||||||
|
|
||||||
def body=(value)
|
def body=(value)
|
||||||
@body = value.tap { @content_length = body.bytes.count.to_s }
|
@body = value.tap { @content_length = value.bytes.count.to_s }
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
|
|
@ -216,7 +216,7 @@ module NanoServe
|
||||||
end
|
end
|
||||||
|
|
||||||
def content_length
|
def content_length
|
||||||
@content_length ||= body.bytes.count.to_s
|
@content_length || '0'
|
||||||
end
|
end
|
||||||
|
|
||||||
def content_type
|
def content_type
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue