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

Firefox Support - Headers.prototype.getAll method has been removed #177

Closed
dovy opened this issue Mar 17, 2017 · 8 comments
Closed

Firefox Support - Headers.prototype.getAll method has been removed #177

dovy opened this issue Mar 17, 2017 · 8 comments

Comments

@dovy
Copy link
Contributor

dovy commented Mar 17, 2017

The Headers.prototype.getAll method has been removed as per the latest Fetch spec. Instead, the Headers.prototype.get method now returns the all values of a given HTTP header in a comma-separated string instead of just the first value.

https://www.fxsitecompat.com/en-CA/docs/2016/headers-getall-has-been-removed-in-favour-of-get-now-returning-all-values/

Need to use Headers.get() instead.

@dovy
Copy link
Contributor Author

dovy commented Mar 17, 2017

Solution:

return all === true ? response.headers.getAll(header) : response.headers.get(header);

try {
    return all === true ? response.headers.getAll(header) : response.headers.get(header);
} catch(err) { // Firefox shim
    return response.headers.get(header);
}

@stoicflame
Copy link
Member

Wait a minute...

Are you saying that Firefox doesn't maintain full backwards compatibility forever? Seriously, getting a little annoyed here. Don't you think they should provide some parameter we can pass to revert to the old FF 51 behavior?

😉 Just teasing, @dovy.

@dovy
Copy link
Contributor Author

dovy commented Mar 18, 2017

I agree and i think it's totally unacceptable. Remember, they're not the best nowadays. I haven't used them for 3 years. ;)

@dovy
Copy link
Contributor Author

dovy commented Mar 18, 2017

But this is more of a standard change and FireFox is just being more proactive than others.

@stoicflame
Copy link
Member

😃 Yes. Of course.

@justincy
Copy link
Contributor

justincy commented Mar 21, 2017

@dovy I'm curious what your usecase is for using the all parameter of the getHeader() method. The SDK never uses it.

I believe that an easier fix would be to deprecate and ignore the all parameter.

@dovy
Copy link
Contributor Author

dovy commented Mar 21, 2017

I wasn't using it. It's in the piping and firefox was shooting errors when checking for attaching a source to a person. It checks the header to ensure that it's been given a "created" header, than then move forward. This was failing in firefox and causing my app to just freeze with a JS error.

@justincy
Copy link
Contributor

I was wrong about the all parameter it not being used in the SDK:

this.addLinks(this.helpers.parseLinkHeaders(response.getHeader('link', true)));

I think we can just update that one internal usage and call it good.

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

3 participants