-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Hello,
I have noticed that my app (GlobalDIal) receives truncated HTML when rendering any page on the development environment.
- Version used:
hotwire-spark (0.1.13)
I believe this is due to the current implementation of the "Content-Length"
header in Hotwire::Spark::Middleware
.
class Hotwire::Spark::Middleware
...
def call(env)
...
headers["Content-Length"] = html.bytesize.to_s if html
response = [ html ]
end
I could not yet find a reason why .bytesize
method is not calculating the content length correctly, but I executed two tests that confirm the calculation is not correct:
- disabled hotwire-spark in my local development
- removed the "Content-Length" header from the response coming from the middleware and letting Rack provide that calculation to the response.
In both cases, the truncating problem was fixed.
My implementation then became:
class Hotwire::Spark::Middleware
...
def call(env)
...
headers.delete("Content-Length"])
response = [ html ]
end
Is anyone else facing similar issues? I opened a Pull Request to address this change and I hope it can help anyone else that might be facing the same situation.
Metadata
Metadata
Assignees
Labels
No labels