Stan Hu
Stan Hu
I'm going to close this issue because this problem seems to have gone away in Rack v2.2.3, but v2.1.x has this issue. https://github.com/rack/rack/pull/1535 might have helped.
Closed too soon. I got this with v2.2.3 as well.
Based on https://github.com/rack/rack/pull/1713#issuecomment-709379195, it sounds like Grape should flag responses that don't contain String values?
I created this middleware: ```ruby class ResponseCoercerMiddleware < ::Grape::Middleware::Base def call(env) response = super(env) status = response[0] body = response[2] return response if Rack::Utils::STATUS_WITH_NO_ENTITY_BODY[status] return response unless body.is_a?(Array) body.map! do...
I wonder if we want to add some variant of this to the base middleware.
> my question was also whether it matters if we put `Hash` in `requires :bar, type: Array do`, so whether we need to have this test try both Hash and...
Oh, you were asking about `Hash`. Let me look at that.
Yes, it's the same. I just picked the commit in https://github.com/ruby-grape/grape/pull/2117.
> Attempting to change that by setting a default value to [] doesn't work either because if the caller provides nil, then the default value is not applied by design?...
> Why do you want to clear all values when a parameter is not provided? Seems like the user of the API doesn't intend to do anything, then do nothing....