@knime/utils 1.8.0 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @knime/utils
|
|
2
2
|
|
|
3
|
+
## 1.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- dcb9fdd: Fix error rejection for createAbortablePromise util
|
|
8
|
+
|
|
9
|
+
## 1.9.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- c4bd90d: treat etags in upload as optional, adjust docs
|
|
14
|
+
|
|
3
15
|
## 1.8.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -28,6 +28,7 @@ const uploadChunkWithProgress = (params: {
|
|
|
28
28
|
const { method, url, chunk, chunkIndex, onProgress, abortSignal } = params;
|
|
29
29
|
|
|
30
30
|
const OK = 200;
|
|
31
|
+
const CREATED = 201;
|
|
31
32
|
|
|
32
33
|
return new Promise<{ partId: string }>((resolve, reject) => {
|
|
33
34
|
const xhr = new XMLHttpRequest();
|
|
@@ -44,17 +45,13 @@ const uploadChunkWithProgress = (params: {
|
|
|
44
45
|
};
|
|
45
46
|
|
|
46
47
|
xhr.onload = () => {
|
|
47
|
-
if (xhr.status === OK) {
|
|
48
|
+
if (xhr.status === OK || xhr.status === CREATED) {
|
|
48
49
|
const etag = xhr.getResponseHeader("ETag");
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// remove possible doublequotes (") around the etag and/or weak identifier (if either is present)
|
|
51
|
+
// 1. note that some backends don't return the etag header, then we just set an empty string
|
|
52
|
+
// 2. remove possible doublequotes (") around the etag and/or weak identifier (if either is present)
|
|
56
53
|
// https://datatracker.ietf.org/doc/html/rfc7232#section-2.3
|
|
57
|
-
resolve({ partId: etag
|
|
54
|
+
resolve({ partId: etag?.replace(/^(?:W\/)?"|"$/g, "") ?? "" });
|
|
58
55
|
} else {
|
|
59
56
|
consola.error("Failed or unexpected XHR response", {
|
|
60
57
|
xhrStatus: xhr.status,
|