Tus: add withCredentials, fix #2518 (#2544)

Co-authored-by: Renée Kooi <renee@kooi.me>
This commit is contained in:
Shlomo Zalman Heigh 2020-09-28 05:56:47 -04:00 committed by GitHub
parent 6ea7a1bfe8
commit 91c7ea03ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -70,7 +70,8 @@ module.exports = class Tus extends Plugin {
resume: true,
useFastRemoteRetry: true,
limit: 0,
retryDelays: [0, 1000, 3000, 5000]
retryDelays: [0, 1000, 3000, 5000],
withCredentials: false
}
// merge default options with the ones set by user
@ -198,6 +199,11 @@ module.exports = class Tus extends Plugin {
// the other in folder b.
uploadOptions.fingerprint = getFingerprint(file)
uploadOptions.onBeforeRequest = (req) => {
const xhr = req.getUnderlyingObject()
xhr.withCredentials = !!opts.withCredentials
}
uploadOptions.onError = (err) => {
this.uppy.log(err)

View file

@ -18,6 +18,7 @@ declare module Tus {
autoRetry?: boolean
limit?: number
useFastRemoteRetry?: boolean
withCredentials?: boolean
}
}