Skip to content

Fix escaped URI cache keys when ignoring query order - #46

Open
bensynapse wants to merge 1 commit into
chenyahui:mainfrom
bensynapse:fix-escaped-cache-keys
Open

bensynapse wants to merge 1 commit into
chenyahui:mainfrom
bensynapse:fix-escaped-cache-keys

Conversation

@bensynapse

Copy link
Copy Markdown

I run Live Tennis API.

With IgnoreQueryOrder(), /cache?x=a%26y%3Db and /cache?x=a&y=b currently share a response cache entry. The second request receives the first response.

Encode the sorted query values and retain the escaped path. Invalid query escapes use the existing raw URI fallback. Reordered parameters and repeated values still share a cache entry.

The regressions cover both IgnoreQueryOrder() and CacheStrategyRequestURIIgnoreQueryOrder. Twenty-one regression cases fail against the original code.

go test -race -coverprofile=coverage.xml -v ./... and go build -v ./... pass on Go 1.13.15 and 1.23.4. go vet ./... and golangci-lint 1.54.2 also pass.

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

Successfully merging this pull request may close these issues.

1 participant