Fixed default Model cache key generation issue #1084
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Support GET & POST requests
The default generator was ignoring variances between
GET
&POST
methods. This causedPOST
requests to get cached incorrectly. Now, both the request query and body are loaded and merged into a common object and stringified as part of the key generation omitting query params from the url string. This will make the url be the same betweenGET
andPOST
and allow for the parameters to be common when submitted into the hasher function.Larger Hash Keys
I also updated the hasher method to use the larger hash size to help prevent collisions since large datasets can be submitted in as part of the caching data. Users of the api can submit in large sets of
OBJECTIDS
and Geometry as part of query parameters. This should help mitigate any cache collisions.New Unit Tests
I added some new unit tests to verify that common
GET
andPOST
requests use the same cache even though the request urls will be different. (ie.GET
will be in the query string andPOST
will be in the body)