module M2R::Response::ContentLength
Adds Content-Length header based on body size This is mostly required when you use bare Response
class without any framework on top of it. HTTP
clients require such header when there is body in response. Otherwise they hang out.
@api public
Public Instance Methods
headers(value = GETTER)
click to toggle source
Calls superclass method
# File lib/m2r/response/content_length.rb, line 11 def headers(value = GETTER) if value == GETTER h = super h['Content-Length'] ||= body.bytesize h else super end end