-
Notifications
You must be signed in to change notification settings - Fork 73
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
Extend supported methods #140
Comments
In addition to the above, and I'm not sure if the feature already exists, but anyway, it is good if we have an option to skip the caching for a specific route/endpoint. Basically, I need to be able to cache all the GET requests of the app except for a list of defined endpoints. This can be added to |
I might have found a way to go around this, but it seems like hack and not a straightforward solution, but I think it works.
In my app I do this: extra: {
"@cache_options@": currentCacheOptions.copyWith(
policy: CachePolicy.noCache,
),
}, |
@mahmoud-othmane you can do this explicitly for each route. response = await dio.get('https://www.foo.com',
options: options.copyWith(policy: CachePolicy.noCache).toOptions(),
); This way allows to cache every routes but those you've chosen or you can invert it by specifying |
Oh okay got it. Thank you! @llfbandit |
Currently, only GET requests seem to be handled and optionally POST methods, if allowPostMethod == true. I suggest replacing allowPostMethod with allowedMethods: Set, so the user can configure which methods should be cached. As HTTP is used e.g. for WebDAV, that set may even include non-standard HTTP methods like PROPFIND, so just hardcoding all HTTP methods seems too restrictive to me. This should be a minor change in the _shouldSkip() function.
The text was updated successfully, but these errors were encountered: