correct way to skip cache for onedrive
This commit is contained in:
parent
9e29405103
commit
f6f7d83a35
@ -444,6 +444,7 @@ export class WrappedOnedriveClient {
|
|||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${await this.authGetter.getAccessToken()}`,
|
Authorization: `Bearer ${await this.authGetter.getAccessToken()}`,
|
||||||
|
"Cache-Control": "no-cache",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@ -460,6 +461,7 @@ export class WrappedOnedriveClient {
|
|||||||
body: JSON.stringify(payload),
|
body: JSON.stringify(payload),
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${await this.authGetter.getAccessToken()}`,
|
Authorization: `Bearer ${await this.authGetter.getAccessToken()}`,
|
||||||
|
"Cache-Control": "no-cache",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@ -476,6 +478,7 @@ export class WrappedOnedriveClient {
|
|||||||
body: JSON.stringify(payload),
|
body: JSON.stringify(payload),
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${await this.authGetter.getAccessToken()}`,
|
Authorization: `Bearer ${await this.authGetter.getAccessToken()}`,
|
||||||
|
"Cache-Control": "no-cache",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@ -490,6 +493,7 @@ export class WrappedOnedriveClient {
|
|||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${await this.authGetter.getAccessToken()}`,
|
Authorization: `Bearer ${await this.authGetter.getAccessToken()}`,
|
||||||
|
"Cache-Control": "no-cache",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -497,6 +501,7 @@ export class WrappedOnedriveClient {
|
|||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${await this.authGetter.getAccessToken()}`,
|
Authorization: `Bearer ${await this.authGetter.getAccessToken()}`,
|
||||||
|
"Cache-Control": "no-cache",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -517,6 +522,7 @@ export class WrappedOnedriveClient {
|
|||||||
headers: {
|
headers: {
|
||||||
"Content-Type": DEFAULT_CONTENT_TYPE,
|
"Content-Type": DEFAULT_CONTENT_TYPE,
|
||||||
Authorization: `Bearer ${await this.authGetter.getAccessToken()}`,
|
Authorization: `Bearer ${await this.authGetter.getAccessToken()}`,
|
||||||
|
"Cache-Control": "no-cache",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -526,6 +532,7 @@ export class WrappedOnedriveClient {
|
|||||||
headers: {
|
headers: {
|
||||||
"Content-Type": DEFAULT_CONTENT_TYPE,
|
"Content-Type": DEFAULT_CONTENT_TYPE,
|
||||||
Authorization: `Bearer ${await this.authGetter.getAccessToken()}`,
|
Authorization: `Bearer ${await this.authGetter.getAccessToken()}`,
|
||||||
|
"Cache-Control": "no-cache",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -565,6 +572,7 @@ export class WrappedOnedriveClient {
|
|||||||
headers: {
|
headers: {
|
||||||
// no "Content-Length" allowed here
|
// no "Content-Length" allowed here
|
||||||
"Content-Range": `bytes ${rangeStart}-${rangeEnd - 1}/${size}`,
|
"Content-Range": `bytes ${rangeStart}-${rangeEnd - 1}/${size}`,
|
||||||
|
/* "Cache-Control": "no-cache", not allowed here!!! */
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return res.json as DriveItem | UploadSession;
|
return res.json as DriveItem | UploadSession;
|
||||||
@ -576,6 +584,7 @@ export class WrappedOnedriveClient {
|
|||||||
"Content-Length": `${rangeEnd - rangeStart}`,
|
"Content-Length": `${rangeEnd - rangeStart}`,
|
||||||
"Content-Range": `bytes ${rangeStart}-${rangeEnd - 1}/${size}`,
|
"Content-Range": `bytes ${rangeStart}-${rangeEnd - 1}/${size}`,
|
||||||
"Content-Type": DEFAULT_CONTENT_TYPE,
|
"Content-Type": DEFAULT_CONTENT_TYPE,
|
||||||
|
/* "Cache-Control": "no-cache", not allowed here!!! */
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return (await res.json()) as DriveItem | UploadSession;
|
return (await res.json()) as DriveItem | UploadSession;
|
||||||
@ -809,10 +818,21 @@ const downloadFromRemoteRaw = async (
|
|||||||
);
|
);
|
||||||
const downloadUrl: string = rsp["@microsoft.graph.downloadUrl"];
|
const downloadUrl: string = rsp["@microsoft.graph.downloadUrl"];
|
||||||
if (VALID_REQURL) {
|
if (VALID_REQURL) {
|
||||||
const content = (await requestUrl({ url: downloadUrl })).arrayBuffer;
|
const content = (
|
||||||
|
await requestUrl({
|
||||||
|
url: downloadUrl,
|
||||||
|
headers: { "Cache-Control": "no-cache" },
|
||||||
|
})
|
||||||
|
).arrayBuffer;
|
||||||
return content;
|
return content;
|
||||||
} else {
|
} else {
|
||||||
const content = await (await fetch(downloadUrl)).arrayBuffer();
|
const content = await (
|
||||||
|
await fetch(downloadUrl, {
|
||||||
|
headers: {
|
||||||
|
"Cache-Control": "no-cache",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
).arrayBuffer();
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user