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

[Question] parseMediaType(), and parameters after q-value #57

Closed
AnyhowStep opened this issue May 8, 2019 · 4 comments
Closed

[Question] parseMediaType(), and parameters after q-value #57

AnyhowStep opened this issue May 8, 2019 · 4 comments
Labels

Comments

@AnyhowStep
Copy link

AnyhowStep commented May 8, 2019

I was just curious about why parseMediaType() doesn't parse parameters after the q value,

if (key === 'q') {
q = parseFloat(value);
break;
}

//key before q
preferredMediaTypes("a/a;q=1, b/b;key=*;q=1", ["a/a","b/b"])
//b/b more preferred
//["b/b", "a/a"]

//key after q
preferredMediaTypes("a/a;q=1, b/b;q=1;key=*", ["a/a","b/b"])
//a/a more preferred
//["a/a", "b/b"]
@AnyhowStep AnyhowStep changed the title [Question] preferredMediaTypes(), and parameters after q-value [Question] parseMediaType(), and parameters after q-value May 8, 2019
@dougwilson
Copy link
Contributor

Parameters are only those before the q. https://tools.ietf.org/html/rfc7231#section-5.3.2

@AnyhowStep
Copy link
Author

I see.

I also noticed there's an optional accept-ext part that comes after the q that looks syntactically the same as the parameters part.

I couldn't find the purpose of accept-ext in that RFC, though.

@dougwilson
Copy link
Contributor

It's effectively useless and an historical artifact.

@AnyhowStep
Copy link
Author

Ah, all right. Thanks!

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

No branches or pull requests

2 participants