Fix 400 errors not being logged in multipart middleware
In gitlab-com/gl-infra/production#5194 (closed), we saw that Workhorse was logging 400 errors, but we could not see an associated error in the API logs to explain why this was happening.
According to https://github.com/rack/rack/blob/master/SPEC.rdoc#label-The+Body, Rack v2.1+ now requires:
The Body must respond to
each
and must only yield String values
Since the response returned returned a plain string, we would only see this mysterious error in the Puma stderr logs:
Read: #<NoMethodError: undefined method `each' for <String:0x1234>
Making things worse, Puma didn't display the backtrace, and this exception wasn't caught by Sentry because the exception was happening outside of the middleware chain.
We fix this by wrapping the string in an array.
Relates to #336609 (closed)
Edited by Stan Hu