Skip to content
This repository has been archived by the owner on Nov 22, 2018. It is now read-only.

Add support for vary by query string params #21

Merged
merged 1 commit into from
Aug 29, 2016
Merged

Conversation

JunTaoLuo
Copy link
Contributor

if (varyBy.Params.Count == 1 && string.Equals(varyBy.Params[0], "*", StringComparison.OrdinalIgnoreCase))
{
// Vary by all available query params
foreach (var query in _httpContext.Request.Query.OrderBy(q => q.Key))
Copy link
Contributor Author

@JunTaoLuo JunTaoLuo Aug 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few issues here.

  1. order by case sensitivity? The QueryCollection operates on case-insensitive keys so maybe we need to order by IgnoreCase and convert all query keys to upper/lower case. Sigh perf...
  2. Linq vs Array.Sort() or List.Sort(). Was using Linq to guarantee a stable sort but I think the keys are unique so it doesn't matter. Need to check the impact on performance.
  3. Could consider using the raw QueryString but that approach will forgo order-insensitivity of the params. I don't think we should do this unless perf is a big problem here.

@Tratcher
Copy link
Member

:shipit:

@JunTaoLuo JunTaoLuo merged commit 1d6c5af into dev Aug 29, 2016
@JunTaoLuo JunTaoLuo deleted the johluo/vary-params branch August 29, 2016 23:39
@JunTaoLuo JunTaoLuo mentioned this pull request Aug 29, 2016
34 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants