You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
put '/concerts/1' do
example_request 'Update an existing concert', concert: {year: 2011} do
...
end
end
would receive no PUT body/params, rather than the specified concert: {year: 2011}.
The reason is that the function params was returning nil if example.metadata[:parameters] was undefined, and the only one to define example.metadata[:parameters] was to have previously called parameter.
In other words, requests were not allowed to have so-called "extra parameters" unless they had at least one "parameter" specified.
This commit removes this restrictions, allowing requests to specify all their parameters "inline".
Without this commit, the following request:
post '/orders' do
example_request 'should take an optional parameter hash', order_type: 'big' do
...
end
end
would **not receive** the POST body/param `order_type: 'big'` specified.
The reason is that the function `params` was returning nil if
example.metadata[:parameters] was undefined, and the only one to
define example.metadata[:parameters] was to have previously called
"parameter". In other words, requests were not allowed to have so-called
"extra parameters" unless they had at least one "parameter" specified.
This commit removes this restrictions, allowing requests to specify all
their parameters "inline".
The reason will be displayed to describe this comment to others. Learn more.
Wow I feel stupid here (facepalm) -- I was setting let(:raw_data) { params.to_json } instead of let(:raw_post) { ....}. I was getting this error doing the following:
post '/users' do
let(:raw_data) { params.to_json }
example 'creating a user' do
do_request raw_data
end
end
This causes the error where your passing do_request a string and you get an error saying inject method is not defined (which is accurate).
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Without this commit, the following request:
would receive no PUT body/params, rather than the specified
concert: {year: 2011}.The reason is that the function
paramswas returning nil ifexample.metadata[:parameters]was undefined, and the only one to defineexample.metadata[:parameters]was to have previously calledparameter.In other words, requests were not allowed to have so-called "extra parameters" unless they had at least one "parameter" specified.
This commit removes this restrictions, allowing requests to specify all their parameters "inline".