Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make all header names case insensitive #147

Closed
RoboSparrow opened this issue Jun 27, 2017 · 3 comments
Closed

make all header names case insensitive #147

RoboSparrow opened this issue Jun 27, 2017 · 3 comments
Assignees
Milestone

Comments

@RoboSparrow
Copy link
Member

RoboSparrow commented Jun 27, 2017

https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2

Field names are case-insensitive.

A good example is the new Javascript fetch api who lowercases all header names by default

Fetch is now supported by all browsers

const headers = {
    'Authorization': 'Basic ' + btoa(lrs.auth),
    'X-Experience-API-Version':  lrs.version,
    'Content-Type': 'application/json',
};

fetch(url, {
    method: 'GET',
    headers: new Headers(headers),
    mode: 'cors'
}).then((res) => {
    //success
}).catch((error) => {
    //error
})
;

Request headers

Accept:*/*
Accept-Encoding:gzip, deflate, br
Accept-Language:en-US,en;q=0.8,de;q=0.6
authorization:Basic MHBSRzViaU9UZ1E3NjJkaUZvbmRJdzVCS0poRGtLbEwzdUl5Z1VCOTprSEMxekJ3b2t4a0YxakhWRGdDckplWXM1M2lMR1ZqMFNBRnRMRHZV
Cache-Control:no-cache
Connection:keep-alive
content-type:application/json
Host:sandbox.experience.at
Origin:http://localhost:3000
Pragma:no-cache
Referer:http://localhost:3000/
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36
x-experience-api-version:1.0.2

Response

401 Unauthorized {"error_message":"Credentials invalid!"}
@RoboSparrow
Copy link
Member Author

RoboSparrow commented Jun 27, 2017

I think this issue exists where we work with Slim's $request->rawHeaders()

@RoboSparrow RoboSparrow self-assigned this Jun 27, 2017
@RoboSparrow
Copy link
Member Author

@sraka1 see PR comments

@RoboSparrow
Copy link
Member Author

end-to-end tests (npm update required!): https://github.com/Brightcookie/lx-Test-Suite/commit/105073d9c65c711b168d191100b8f2014bc4693b

node test -d test/fetchApi 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants