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

Caching the availableMediaTypes #52

Open
s-ko-mo opened this issue Oct 28, 2016 · 1 comment
Open

Caching the availableMediaTypes #52

s-ko-mo opened this issue Oct 28, 2016 · 1 comment
Assignees
Labels

Comments

@s-ko-mo
Copy link

s-ko-mo commented Oct 28, 2016

Hello,

currently the incomming request is given to the constructur of 'Negotiator' and the 'availableMediaTypes' to 'negotiator.mediaTypes'. So for each request a new Negotiator instances needs to be created and the availableMediaTypes are prepared (at https://github.com/jshttp/negotiator/blob/master/lib/mediaType.js#L174)

Think changing the API constructor and availableMediaTypes is not possible due to backward compatibility. But maybe a new function which allows reusing the perpared priorities of the availableMediaTypes would be nice.

Thanks and kind regards,
Sven

@dougwilson dougwilson self-assigned this Apr 12, 2017
@ujjwalguptaofficial
Copy link

It would be really nice to cache the output. I am using this in my framework - fortjs. I am working on optimization and found that if we can cache the negotiation part which is same most of the time, then it would be great.

Please add this feature.

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

3 participants