19899: Use "Cache-Control: no-cache" in request instead of must-revalidate 19899-cache-control-fix
authorPeter Amstutz <peter.amstutz@curii.com>
Tue, 21 Mar 2023 16:09:09 +0000 (12:09 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Tue, 21 Mar 2023 16:09:09 +0000 (12:09 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

src/common/webdav.test.ts
src/common/webdav.ts

index 0a3b5170f64d34cf817a81f55bafa1b6d41c3aa2..1149c451e3991fc9bc07eb463989b00ed4d17495 100644 (file)
@@ -13,7 +13,7 @@ describe('WebDAV', () => {
         const request = await promise;
         expect(open).toHaveBeenCalledWith('PROPFIND', 'http://foo.com/foo');
         expect(setRequestHeader).toHaveBeenCalledWith('Authorization', 'Basic');
-        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'must-revalidate');
+        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'no-cache');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 
@@ -26,7 +26,7 @@ describe('WebDAV', () => {
         const request = await promise;
         expect(open).toHaveBeenCalledWith('PROPFIND', 'http://foo.com/foo');
         expect(setRequestHeader).toHaveBeenCalledWith('Authorization', 'Basic');
-        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'must-revalidate');
+        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'no-cache');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 
@@ -37,7 +37,7 @@ describe('WebDAV', () => {
         load();
         const request = await promise;
         expect(open).toHaveBeenCalledWith('PROPFIND', 'foo');
-        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'must-revalidate');
+        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'no-cache');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 
@@ -50,7 +50,7 @@ describe('WebDAV', () => {
         const request = await promise;
         expect(open).toHaveBeenCalledWith('PUT', 'foo');
         expect(send).toHaveBeenCalledWith('Test data');
-        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'must-revalidate');
+        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'no-cache');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 
@@ -62,7 +62,7 @@ describe('WebDAV', () => {
         const request = await promise;
         expect(open).toHaveBeenCalledWith('COPY', 'http://base/foo');
         expect(setRequestHeader).toHaveBeenCalledWith('Destination', 'http://base/foo-copy');
-        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'must-revalidate');
+        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'no-cache');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 
@@ -74,7 +74,7 @@ describe('WebDAV', () => {
         const request = await promise;
         expect(open).toHaveBeenCalledWith('COPY', 'http://base/foo');
         expect(setRequestHeader).toHaveBeenCalledWith('Destination', 'http://base/foo-copy');
-        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'must-revalidate');
+        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'no-cache');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 
@@ -86,7 +86,7 @@ describe('WebDAV', () => {
         const request = await promise;
         expect(open).toHaveBeenCalledWith('COPY', 'http://base/foo');
         expect(setRequestHeader).toHaveBeenCalledWith('Destination', 'http://base/foo-copy');
-        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'must-revalidate');
+        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'no-cache');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 
@@ -98,7 +98,7 @@ describe('WebDAV', () => {
         const request = await promise;
         expect(open).toHaveBeenCalledWith('MOVE', 'http://base/foo');
         expect(setRequestHeader).toHaveBeenCalledWith('Destination', 'http://base/foo-moved');
-        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'must-revalidate');
+        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'no-cache');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 
@@ -110,7 +110,7 @@ describe('WebDAV', () => {
         const request = await promise;
         expect(open).toHaveBeenCalledWith('MOVE', 'http://base/foo');
         expect(setRequestHeader).toHaveBeenCalledWith('Destination', 'http://base/foo-moved');
-        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'must-revalidate');
+        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'no-cache');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 
@@ -122,7 +122,7 @@ describe('WebDAV', () => {
         const request = await promise;
         expect(open).toHaveBeenCalledWith('MOVE', 'http://base/foo');
         expect(setRequestHeader).toHaveBeenCalledWith('Destination', 'http://base/foo-moved');
-        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'must-revalidate');
+        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'no-cache');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 
@@ -133,7 +133,7 @@ describe('WebDAV', () => {
         load();
         const request = await promise;
         expect(open).toHaveBeenCalledWith('DELETE', 'foo');
-        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'must-revalidate');
+        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'no-cache');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 });
index bb8a68bdd221e1733d42f0f64b8c61e434863304..1f3da0d6148f4bb45c2406c8e544f35f125aa990 100644 (file)
@@ -9,7 +9,7 @@ export class WebDAV {
     private defaults: WebDAVDefaults = {
         baseURL: '',
         headers: {
-            'Cache-Control': 'must-revalidate'
+            'Cache-Control': 'no-cache'
         },
     };
 
@@ -94,7 +94,7 @@ export class WebDAV {
             this.defaults.baseURL = this.defaults.baseURL.replace(/\/+$/, '');
             r.open(config.method,
                 `${this.defaults.baseURL
-                    ? this.defaults.baseURL+'/'
+                    ? this.defaults.baseURL + '/'
                     : ''}${customEncodeURI(config.url)}`);
 
             const headers = { ...this.defaults.headers, ...config.headers };