headerAPI was introduced in bf5f62868fc9a076358b254072af118dc909e28f, 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.
header
API was introduced in bf5f62868fc9a076358b254072af118dc909e28f, 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 withHTTP_
prefix. So the correct implementation might beOr the user has to call
header('HTTP_KEYNAME')
if he/she wants to make sure theKEYNAME
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.