Minor changes
This commit is contained in:
parent
bb15daae6b
commit
b5a3ec2f86
@ -1,10 +1,10 @@
|
||||
export function fetchWithProgress(url, opts: RequestInit, onProgress: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null): Promise<string> {
|
||||
export function fetchWithProgress(url, options: RequestInit, onProgress: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
let xhr = new XMLHttpRequest()
|
||||
xhr.open(opts.method || "GET", url)
|
||||
xhr.open(options.method || "GET", url)
|
||||
|
||||
for(let k in opts.headers || {}) {
|
||||
xhr.setRequestHeader(k, opts.headers[k])
|
||||
for(let k in options.headers || {}) {
|
||||
xhr.setRequestHeader(k, options.headers[k])
|
||||
}
|
||||
|
||||
xhr.onload = e => resolve(xhr.responseText)
|
||||
@ -14,6 +14,6 @@ export function fetchWithProgress(url, opts: RequestInit, onProgress: ((this: XM
|
||||
xhr.upload.onprogress = onProgress
|
||||
}
|
||||
|
||||
xhr.send(opts.body)
|
||||
xhr.send(options.body)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user