From: Peter Amstutz Date: Tue, 21 Mar 2023 16:09:09 +0000 (-0400) Subject: 19899: Use "Cache-Control: no-cache" in request instead of must-revalidate X-Git-Tag: 2.6.0~8^2 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/e16f2125588512201e3bd22ae9a19e10cb69d367 19899: Use "Cache-Control: no-cache" in request instead of must-revalidate Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- diff --git a/src/common/webdav.test.ts b/src/common/webdav.test.ts index 0a3b5170..1149c451 100644 --- a/src/common/webdav.test.ts +++ b/src/common/webdav.test.ts @@ -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); }); }); diff --git a/src/common/webdav.ts b/src/common/webdav.ts index bb8a68bd..1f3da0d6 100644 --- a/src/common/webdav.ts +++ b/src/common/webdav.ts @@ -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 };