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

Feature: option for disabling caching #56

Merged
merged 2 commits into from
Aug 31, 2019
Merged

Conversation

antoinechalifour
Copy link
Owner

This pull requests adds a new option to the Memento configuation: disableCachingPatterns, which is an array of objects that have a method and pattern properties.

  • The method property is a case insensitive HTTP method.
  • The pattern property is a glob tested against the incoming URL (the minimatch package is used as an implementation).

Fixes #54 .

@codecov-io
Copy link

codecov-io commented Aug 31, 2019

Codecov Report

Merging #56 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #56      +/-   ##
==========================================
+ Coverage   99.04%   99.06%   +0.02%     
==========================================
  Files          21       21              
  Lines         417      427      +10     
  Branches       41       43       +2     
==========================================
+ Hits          413      423      +10     
  Misses          1        1              
  Partials        3        3
Impacted Files Coverage Δ
src/domain/entity/index.ts 100% <ø> (ø) ⬆️
src/domain/usecase/RespondToRequest.ts 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f871218...fcc0034. Read the comment docs.

@francoischalifour
Copy link

Here's another suggestion for the option name: requestIgnorePatterns.

{
  "requestIgnorePatterns": [{
    "method": "GET",
    "urlPattern": "/pokemon/*/abilities"
  }]
}

From what I see, only the URL can match against the pattern. It would make sense to mention the term "url" in the "pattern" key name.

@antoinechalifour
Copy link
Owner Author

antoinechalifour commented Aug 31, 2019

I definitely like urlPattern more than pattern!
Not really about requestIgnorePatterns, I think that disableCachingPatterns is more explicit in the sense that this option... disables caching.

Request are not ignored, they are forwarded using Memento, they just aren't cached.

@antoinechalifour antoinechalifour merged commit 6c71144 into master Aug 31, 2019
@antoinechalifour antoinechalifour deleted the disable-caching branch August 31, 2019 13:39
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.

Add mode to disable caching
3 participants