From 13444cf4368213be2ef464b8c1aaf97beda98ea9 Mon Sep 17 00:00:00 2001 From: Michael Knight Date: Wed, 19 Oct 2016 12:28:18 +1100 Subject: [PATCH] Encode extra_params to handle spaces. For example, using get_all_monitors() with 'group_states' including the state 'no data' would result in a 400 error prior to this change. --- lib/dogapi/common.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dogapi/common.rb b/lib/dogapi/common.rb index c3851dde..013e799e 100644 --- a/lib/dogapi/common.rb +++ b/lib/dogapi/common.rb @@ -136,7 +136,7 @@ def prepare_params(extra_params, with_app_key) params = { api_key: @api_key } params[:application_key] = @application_key if with_app_key params = extra_params.merge params unless extra_params.nil? - qs_params = params.map { |k, v| k.to_s + '=' + v.to_s } + qs_params = params.map { |k, v| CGI.escape(k.to_s) + '=' + CGI.escape(v.to_s) } qs = '?' + qs_params.join('&') qs end