File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ## 2.3.1
2+ - fix: Cache-Control parsing. Dio does not expand multi valued headers.
3+
14## 2.3.0
25- feat: ` allowPostMethod ` added to ` CacheOptions ` .
36
Original file line number Diff line number Diff line change @@ -37,16 +37,22 @@ class CacheControl {
3737 final other = < String > [];
3838
3939 for (var value in headerValues) {
40- if (value == 'no-cache' ) {
41- noCache = true ;
42- } else if (value == 'no-store' ) {
43- noStore = true ;
44- } else if (value == 'public' || value == 'private' ) {
45- privacy = value;
46- } else if (value.startsWith ('max-age' )) {
47- maxAge = int .tryParse (value.substring (value.indexOf ('=' ) + 1 ));
48- } else {
49- other.add (value);
40+ // Expand values since dio does not do it !
41+ for (var expandedValue in value.split (',' )) {
42+ expandedValue = expandedValue.trim ();
43+ if (expandedValue == 'no-cache' ) {
44+ noCache = true ;
45+ } else if (expandedValue == 'no-store' ) {
46+ noStore = true ;
47+ } else if (expandedValue == 'public' || expandedValue == 'private' ) {
48+ privacy = expandedValue;
49+ } else if (expandedValue.startsWith ('max-age' )) {
50+ maxAge = int .tryParse (
51+ expandedValue.substring (expandedValue.indexOf ('=' ) + 1 ),
52+ );
53+ } else {
54+ other.add (expandedValue);
55+ }
5056 }
5157 }
5258
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ description: Dio HTTP cache interceptor with multiple stores respecting HTTP dir
33repository : https://github.com/llfbandit/dio_cache_interceptor
44issue_tracker : https://github.com/llfbandit/dio_cache_interceptor/issues
55
6- version : 2.3.0
6+ version : 2.3.1
77
88environment :
99 sdk : " >=2.12.0 <3.0.0"
Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ class MockHttpClientAdapter extends HttpClientAdapter {
153153 200 ,
154154 headers: {
155155 Headers .contentTypeHeader: [Headers .jsonContentType],
156- 'cache-control' : ['public' , ' max-age=1' ],
156+ 'cache-control' : ['public, max-age=1' ],
157157 },
158158 );
159159 }
You can’t perform that action at this time.
0 commit comments