bdy 1.12.0-dev → 1.12.1-dev

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.12.0-dev",
4
+ "version": "1.12.1-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -34,7 +34,7 @@ async function sendUploadRequest(files, ciInfo) {
34
34
  formData.append('to_revision', ciInfo.toRevision);
35
35
  formData.append('build_id', ciInfo.buildId);
36
36
  const [message, json] = await sendRequest({
37
- url: '/unit-tests/import',
37
+ path: '/unit-tests/import',
38
38
  payload: formData,
39
39
  });
40
40
  if (message) {
@@ -45,9 +45,9 @@ async function sendUploadRequest(files, ciInfo) {
45
45
  }
46
46
  return json;
47
47
  }
48
- async function sendRequest({ url, payload, }) {
49
- const fullUrl = `${getServiceUrl()}${url}`;
50
- output_1.default.debug((0, texts_1.LOG_SENDING_REQUEST)(fullUrl));
48
+ async function sendRequest({ path, payload, }) {
49
+ const fullUrl = new URL(getServiceUrl(), path);
50
+ output_1.default.debug((0, texts_1.LOG_SENDING_REQUEST)(fullUrl.toString()));
51
51
  const init = {
52
52
  method: 'POST',
53
53
  redirect: 'follow',
@@ -91,7 +91,7 @@ async function sendSnapshot(snapshot, firstSnapshot) {
91
91
  };
92
92
  const formData = createFormData(info, files);
93
93
  const [message] = await sendRequest({
94
- url: '/snapshot',
94
+ path: '/snapshot',
95
95
  payload: formData,
96
96
  multipart: true,
97
97
  });
@@ -125,7 +125,7 @@ async function sendSnapshots(snapshots) {
125
125
  };
126
126
  const formData = createFormData(info, files);
127
127
  const [message] = await sendRequest({
128
- url: '/snapshots',
128
+ path: '/snapshots',
129
129
  payload: formData,
130
130
  multipart: true,
131
131
  });
@@ -139,7 +139,7 @@ async function closeSession() {
139
139
  token: context_1.token,
140
140
  buildId: context_1.buildId,
141
141
  };
142
- const [message] = await sendRequest({ url: '/close', payload });
142
+ const [message] = await sendRequest({ path: '/close', payload });
143
143
  if (!message) {
144
144
  throw new Error(texts_1.ERR_INVALID_CLOSE_SESSION_RESPONSE);
145
145
  }
@@ -147,7 +147,7 @@ async function closeSession() {
147
147
  }
148
148
  async function getDefaultSettings() {
149
149
  const [message, response] = await sendRequest({
150
- url: `/defaultSettings`,
150
+ path: `/defaultSettings`,
151
151
  });
152
152
  if (message) {
153
153
  throw new Error(message);
@@ -182,7 +182,7 @@ async function sendStorybook(snapshots, filePaths) {
182
182
  }));
183
183
  const formData = createFormData(info, files);
184
184
  const [message] = await sendRequest({
185
- url: '/storybook',
185
+ path: '/storybook',
186
186
  payload: formData,
187
187
  multipart: true,
188
188
  });
@@ -218,7 +218,7 @@ async function sendCompareLinks(urls, validatedOptions, sitemapSource) {
218
218
  cliId: context_1.cliId,
219
219
  };
220
220
  const [message] = await sendRequest({
221
- url: '/compareLinks',
221
+ path: '/compareLinks',
222
222
  payload: info,
223
223
  });
224
224
  if (!message) {
@@ -243,7 +243,7 @@ async function sendScrap(url, outputType, follow, quality, fullPage, cssSelector
243
243
  waitForElement,
244
244
  };
245
245
  const [message, response] = await sendRequest({
246
- url: '/scrap',
246
+ path: '/scrap',
247
247
  payload,
248
248
  });
249
249
  if (message) {
@@ -256,7 +256,7 @@ async function sendScrap(url, outputType, follow, quality, fullPage, cssSelector
256
256
  }
257
257
  async function downloadScrapPackage(buildId) {
258
258
  const [message, response] = await sendRequest({
259
- url: '/download',
259
+ path: '/download',
260
260
  payload: { token: context_1.token, buildId },
261
261
  });
262
262
  if (message) {
@@ -267,8 +267,9 @@ async function downloadScrapPackage(buildId) {
267
267
  }
268
268
  return response;
269
269
  }
270
- async function sendRequest({ url, payload, multipart, }) {
271
- output_1.default.debug((0, texts_1.LOG_SENDING_REQUEST)(`${getServiceUrl()}${url}`));
270
+ async function sendRequest({ path, payload, multipart, }) {
271
+ const fullUrl = new URL(getServiceUrl(), path);
272
+ output_1.default.debug((0, texts_1.LOG_SENDING_REQUEST)(fullUrl.toString()));
272
273
  const init = {
273
274
  method: 'GET',
274
275
  redirect: 'follow',
@@ -290,7 +291,7 @@ async function sendRequest({ url, payload, multipart, }) {
290
291
  init.method = 'POST';
291
292
  init.body = payload;
292
293
  }
293
- const response = await (0, undici_1.fetch)(`${getServiceUrl()}${url}`, init);
294
+ const response = await (0, undici_1.fetch)(fullUrl, init);
294
295
  const contentType = response.headers.get('content-type');
295
296
  if (contentType && contentType.includes('application/json')) {
296
297
  try {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.12.0-dev",
4
+ "version": "1.12.1-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {