@shieldiot/ngx-pulseiot-lib 2.21.1448 → 2.21.1450
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.
|
@@ -4874,12 +4874,25 @@ class RestUtils {
|
|
|
4874
4874
|
});
|
|
4875
4875
|
return this.http.request(req);
|
|
4876
4876
|
}
|
|
4877
|
-
// Download is HTTP GET action
|
|
4877
|
+
// Download is an HTTP GET action whose response is a blob. For POST-style file exports the single
|
|
4878
|
+
// argument is the serialized JSON request body (the connection list is too large for a query
|
|
4879
|
+
// string), not query params; detect that case (a lone param starting with '{' or '[') and issue a
|
|
4880
|
+
// POST-with-body blob request instead. Query-param callers (k=v strings) are unaffected
|
|
4881
|
+
// (SHIEL-7328 Case 3, Path B — lives in the hand-maintained rest-utils so it survives regen).
|
|
4878
4882
|
download(fileName, url, ...params) {
|
|
4879
4883
|
// Query params are plain strings; a POST-style download may also pass a serialized body
|
|
4880
4884
|
// (string | undefined). Drop any undefined so URL building and the filename scan stay string-only
|
|
4881
4885
|
// (no-op for the existing all-string callers).
|
|
4882
4886
|
const definedParams = params.filter((p) => p !== undefined);
|
|
4887
|
+
// POST-with-body export: a single JSON-object/array param is the request body, not a query param.
|
|
4888
|
+
if (definedParams.length === 1 && /^\s*[{[]/.test(definedParams[0])) {
|
|
4889
|
+
return this.http.post(url, definedParams[0], {
|
|
4890
|
+
responseType: 'blob',
|
|
4891
|
+
reportProgress: true,
|
|
4892
|
+
observe: 'events',
|
|
4893
|
+
headers: new HttpHeaders({ 'Content-Type': 'application/json' })
|
|
4894
|
+
});
|
|
4895
|
+
}
|
|
4883
4896
|
const resourceUrl = this.buildUrl(url, ...definedParams);
|
|
4884
4897
|
let downloadLink = fileName;
|
|
4885
4898
|
// extract file name
|