llfbandit / dio_cache_interceptor

Dio HTTP cache interceptor with multiple stores respecting HTTP directives (ETag, Last-Modified, Cache-Control) with options.
https://pub.dev/packages/dio_cache_interceptor
120 stars 70 forks source link

Support handling 304 status code in onResponse flow #119

Closed tristan-vrt closed 11 months ago

tristan-vrt commented 1 year ago

In Dio a 304 not modified can be configured to be a valid status: BaseOptions(validateStatus: (status) => status != null && ((status >= 200 && status < 300) || status == 304))

This PR allows 304's to be handled in the onResponse flow. This way (having not modified as a valid status) the usual chain of onResponse interceptors will still trigger, unlike the error flow.

tristan-vrt commented 11 months ago

Updated Pull request with master and requested changes.

tristan-vrt commented 11 months ago

I forgot to remove the field callResponseInterceptorsAfterNotModified. Updated my PR ☝️

llfbandit commented 11 months ago

Thanks for your contribution. This PR has been reworked internally and is now available in v3.5.0.