brooklynDev / airborne

RSpec driven API testing framework
MIT License
1.13k stars 122 forks source link

Why header keys are downcased? #143

Open xliiauo opened 7 years ago

xliiauo commented 7 years ago

Hi, I was trying to test out the response headers. And the response header is something like "X-TV-subscriptionId": "12345678", and I tried to expect_header "X-TV-subscriptionId", "12345678" and it returns false, it will return true only if I do expect_header "x_tv_subscriptionid", "12345678".

Wondering is this behaviour intended? As headers are case sensitives anyway, case switch is not an issue for me. But converting hyphen into underscore is breaking my test.

Many thanks in advance.

Update: looks like even expect_header :X_tv_subscriptionid, "12345678" will return a false? The downscore is not working?

rdalverny commented 7 years ago

Yes, this is expected (downcase, underscore instead of hyphen). This is tied to rest-client implementation:

Plus, airborne uses an indifferent access hash, so you may use a string or a symbol as a key.