wdio-test-ledger-service 9.2.8 → 9.2.9

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +11 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wdio-test-ledger-service",
3
- "version": "9.2.8",
3
+ "version": "9.2.9",
4
4
  "description": "WebdriverIO server to send reporter data to testledger.dev",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/index.js CHANGED
@@ -425,7 +425,11 @@ class TestLedgerLauncher {
425
425
  }))
426
426
  };
427
427
 
428
- const response = await fetch(`${this.getApiUrl()}/artifacts/presigned-upload`, {
428
+ const url = `${this.getApiUrl()}/artifacts/presigned-upload`;
429
+
430
+ fs.writeFileSync(`${this.options.reporterOutputDir}/trio-presigned-request.txt`, `URL: ${url}\nPayload: ${JSON.stringify(payload, null, 2)}`, { encoding: 'utf-8' });
431
+
432
+ const response = await fetch(url, {
429
433
  method : 'POST',
430
434
  headers : {
431
435
  'Content-Type' : 'application/json',
@@ -434,6 +438,12 @@ class TestLedgerLauncher {
434
438
  body : JSON.stringify(payload)
435
439
  });
436
440
 
441
+ if (!response.ok) {
442
+ const text = await response.text();
443
+ fs.writeFileSync(`${this.options.reporterOutputDir}/trio-presigned-failed.txt`, `Status: ${response.status} ${response.statusText}\nURL: ${url}\nResponse: ${text.substring(0, 2000)}`, { encoding: 'utf-8' });
444
+ throw new Error(`Presigned URL request failed: HTTP ${response.status}`);
445
+ }
446
+
437
447
  return response.json();
438
448
  }
439
449