Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX:MSF-22702 - Show error message if gd_encoded_params or gd_encoded_hidden_params is not specified #1827

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/gooddata/helpers/global_helpers_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def encode_hidden_params(params)
def decode_params(params, options = {})
key = ENCODED_PARAMS_KEY.to_s
hidden_key = ENCODED_HIDDEN_PARAMS_KEY.to_s
raise "Mandatory parameter '#{key}' or '#{hidden_key}' of type 'HashType' needs to be specified" if params[key].nil? && params[hidden_key].nil?

data_params = params[key] || '{}'
hidden_data_params = if params.key?(hidden_key) && params[hidden_key].nil?
"{\"#{hidden_key}\" : null}"
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/helpers/global_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
end

it 'should encode params and preserve the nil in hidden' do
x = GoodData::Helpers.decode_params(GoodData::Helpers::ENCODED_HIDDEN_PARAMS_KEY.to_s => nil)
expect(x).to eq("gd_encoded_hidden_params" => nil)
x = GoodData::Helpers.decode_params(GoodData::Helpers::ENCODED_HIDDEN_PARAMS_KEY.to_s => nil, GoodData::Helpers::ENCODED_PARAMS_KEY.to_s => '{"d":{"b": "c"}}')
expect(x).to eq({"d"=>{"b"=>"c"}, "gd_encoded_hidden_params"=>nil})
end

it 'should encode params and preserve the nil in hidden' do
Expand Down