From 55052f83efa225dc030107ef6d3fe21666c3108a Mon Sep 17 00:00:00 2001 From: Gibheer Date: Sat, 1 Dec 2012 07:23:37 +0100 Subject: avoid changing existing environment keys --- lib/zero/request/parameter.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/zero/request/parameter.rb b/lib/zero/request/parameter.rb index a9a3abe..73e69e2 100644 --- a/lib/zero/request/parameter.rb +++ b/lib/zero/request/parameter.rb @@ -12,6 +12,8 @@ module Zero ENV_KEY_QUERY = 'QUERY_STRING' # the key for the payload ENV_KEY_PAYLOAD = 'rack.input' + # the key for custom parameters + ENV_KEY_CUSTOM = 'zero.params.custom' # the key for the content type ENV_KEY_CONTENT_TYPE = 'CONTENT_TYPE' # all content types which used for using the body as a parameter input @@ -40,8 +42,12 @@ module Zero def initialize(environment) @query = extract_query_params(environment) @payload = extract_payload_params(environment) - @custom = {} - environment['zero.params.custom'] = @custom + if environment.has_key?(ENV_KEY_CUSTOM) + @custom = environment[ENV_KEY_CUSTOM] + else + @custom = {} + environment[ENV_KEY_CUSTOM] = @custom + end end # get a parameter -- cgit v1.2.3-70-g09d2