aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGibheer <gibheer@gmail.com>2012-12-01 07:23:37 +0100
committerGibheer <gibheer@gmail.com>2012-12-01 07:23:37 +0100
commit55052f83efa225dc030107ef6d3fe21666c3108a (patch)
treed561efbf9b0677cd290300c8ca4303adb7e910c2 /lib
parentcd1d3d6e63a6805f4e2d01f7d7bde9c0898e326a (diff)
avoid changing existing environment keys
Diffstat (limited to 'lib')
-rw-r--r--lib/zero/request/parameter.rb10
1 files changed, 8 insertions, 2 deletions
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