@celonis/content-cli 1.1.2 → 1.1.3

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.
@@ -150,20 +150,36 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
150
150
  return new Promise((resolve, reject) => {
151
151
  this.axios.post(this.resolveUrl(url), null, {
152
152
  headers: this.buildHeaders(),
153
- responseType: "stream"
153
+ responseType: "stream",
154
+ validateStatus: () => true, // Accept all status codes, handle manually
154
155
  }).then(response => {
155
- const data = [];
156
- response.data.on("data", (chunk) => {
157
- data.push(chunk);
158
- });
159
- response.data.on("end", () => {
160
- if (this.checkBadRequest(response.status)) {
161
- this.handleBadRequest(response.status, data.toString(), reject);
162
- }
163
- else {
156
+ if (this.checkBadRequest(response.status)) {
157
+ // For error responses, collect as text for readable error messages
158
+ let errorData = '';
159
+ response.data.setEncoding('utf8');
160
+ response.data.on('data', (chunk) => {
161
+ errorData += chunk;
162
+ });
163
+ response.data.on('end', () => {
164
+ this.handleBadRequest(response.status, errorData, reject);
165
+ });
166
+ response.data.on('error', (err) => {
167
+ reject(`Error reading error response: ${err.message}`);
168
+ });
169
+ }
170
+ else {
171
+ // For successful responses, collect as binary for file download
172
+ const data = [];
173
+ response.data.on("data", (chunk) => {
174
+ data.push(chunk);
175
+ });
176
+ response.data.on("end", () => {
164
177
  this.handleResponseStreamData(Buffer.concat(data), resolve, reject);
165
- }
166
- });
178
+ });
179
+ response.data.on('error', (err) => {
180
+ reject(`Error reading file data: ${err.message}`);
181
+ });
182
+ }
167
183
  }).catch(err => {
168
184
  this.handleError(err, resolve, reject);
169
185
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celonis/content-cli",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "CLI Tool to help manage content in Celonis Platform",
5
5
  "main": "content-cli.js",
6
6
  "bin": {