grape-swagger icon indicating copy to clipboard operation
grape-swagger copied to clipboard

Cannot post Array params

Open michaelwnyc opened this issue 7 years ago • 1 comments

params do
  ...
  optional :user_profiles, type: Array, default: [] do
    requires :value, type: String, desc: "Value of the user profile"
  end
end

Using the above gives me curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d 'user_profiles[value]=1' 'http://localhost:3000/api/v1/accounts/3/users', and it rejects with user_profiles invalid.

Can someone tell me what am I doing wrong here? Thx!

michaelwnyc avatar Jul 25 '17 20:07 michaelwnyc

If I run this curl command it works: curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d 'user_profiles[][value]=1' 'http://localhost:3000/api/v1/accounts/3/users'

This seems to be a bug. Should be the same in #617

michaelwnyc avatar Jul 26 '17 00:07 michaelwnyc