Proposal: remove `header` API
larrylv opened this issue · comments
header
API was introduced in bf5f628, but with no examples or instructions on how to use it and also no tests of it.
Actually from the name header
, we assume it's used to ensure the request has some header with it, but http header in the env hash should be start with HTTP_
prefix. So the correct implementation might be
ENV_HTTP_HEADER_PREFIX = "HTTP_".freeze
def header(key)
lambda { env["#{ENV_HTTP_HEADER_PREFIX}_#{key}".upcase.tr("-","_")] }
end
Or the user has to call header('HTTP_KEYNAME')
if he/she wants to make sure the KEYNAME
exist in the header.
So, as I mentioned early, since there are no examples, instructions and tests on how to use it. Should cuba just remove it?
Or if you are concerned about breaking the backward compatibility, I will be happy to contribute some docs and tests on it.
Thanks a lot for your input! It was removed in the 4.0.0 working branch.
Glad to help. :)
Should this be closed? 😄