@owox/connectors 0.13.0-next-20251118090139 → 0.13.0-next-20251118102534

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/dist/index.cjs CHANGED
@@ -973,11 +973,9 @@ async function _resolveShortLinks(shortLinks) {
973
973
  const response = await HttpUtils.fetch(linkObj.originalUrl, {
974
974
  method: "GET"
975
975
  });
976
- const headers = response.getHeaders();
977
- const resolvedUrl = headers.Location || headers.location || linkObj.originalUrl;
978
976
  return {
979
977
  originalUrl: linkObj.originalUrl,
980
- resolvedUrl
978
+ resolvedUrl: response.getUrl()
981
979
  };
982
980
  } catch (error) {
983
981
  console.log(`Failed to resolve short link ${linkObj.originalUrl}: ${error.message}`);
@@ -1143,17 +1141,21 @@ var HttpUtils = class HttpUtils2 {
1143
1141
  if (options.body) {
1144
1142
  fetchOptions.body = options.body;
1145
1143
  }
1144
+ if (options.redirect !== void 0) {
1145
+ fetchOptions.redirect = options.redirect;
1146
+ }
1146
1147
  const response = await fetch(url, fetchOptions);
1147
- return this._wrapNodeResponse(response);
1148
+ return this._wrapNodeResponse(response, url);
1148
1149
  }
1149
1150
  /**
1150
1151
  * Wraps the response from the Node environment.
1151
1152
  * Not use directly, only for internal purposes.
1152
1153
  *
1153
1154
  * @param {Response} response - Native fetch Response object
1155
+ * @param {string} originalUrl - Original URL that was requested
1154
1156
  * @returns {FetchResponse}
1155
1157
  */
1156
- static _wrapNodeResponse(response) {
1158
+ static _wrapNodeResponse(response, originalUrl) {
1157
1159
  let textCache = null;
1158
1160
  let blobCache = null;
1159
1161
  const getText = async () => {
@@ -1184,7 +1186,8 @@ var HttpUtils = class HttpUtils2 {
1184
1186
  getContent: () => getText(),
1185
1187
  getContentText: () => getText(),
1186
1188
  getBlob: () => getBlob(),
1187
- getResponseCode: () => response.status
1189
+ getResponseCode: () => response.status,
1190
+ getUrl: () => response.url || originalUrl
1188
1191
  };
1189
1192
  }
1190
1193
  };
package/dist/index.js CHANGED
@@ -978,11 +978,9 @@ var require_index = __commonJS({
978
978
  const response = await HttpUtils.fetch(linkObj.originalUrl, {
979
979
  method: "GET"
980
980
  });
981
- const headers = response.getHeaders();
982
- const resolvedUrl = headers.Location || headers.location || linkObj.originalUrl;
983
981
  return {
984
982
  originalUrl: linkObj.originalUrl,
985
- resolvedUrl
983
+ resolvedUrl: response.getUrl()
986
984
  };
987
985
  } catch (error) {
988
986
  console.log(`Failed to resolve short link ${linkObj.originalUrl}: ${error.message}`);
@@ -1148,17 +1146,21 @@ var require_index = __commonJS({
1148
1146
  if (options.body) {
1149
1147
  fetchOptions.body = options.body;
1150
1148
  }
1149
+ if (options.redirect !== void 0) {
1150
+ fetchOptions.redirect = options.redirect;
1151
+ }
1151
1152
  const response = await fetch(url, fetchOptions);
1152
- return this._wrapNodeResponse(response);
1153
+ return this._wrapNodeResponse(response, url);
1153
1154
  }
1154
1155
  /**
1155
1156
  * Wraps the response from the Node environment.
1156
1157
  * Not use directly, only for internal purposes.
1157
1158
  *
1158
1159
  * @param {Response} response - Native fetch Response object
1160
+ * @param {string} originalUrl - Original URL that was requested
1159
1161
  * @returns {FetchResponse}
1160
1162
  */
1161
- static _wrapNodeResponse(response) {
1163
+ static _wrapNodeResponse(response, originalUrl) {
1162
1164
  let textCache = null;
1163
1165
  let blobCache = null;
1164
1166
  const getText = async () => {
@@ -1189,7 +1191,8 @@ var require_index = __commonJS({
1189
1191
  getContent: () => getText(),
1190
1192
  getContentText: () => getText(),
1191
1193
  getBlob: () => getBlob(),
1192
- getResponseCode: () => response.status
1194
+ getResponseCode: () => response.status,
1195
+ getUrl: () => response.url || originalUrl
1193
1196
  };
1194
1197
  }
1195
1198
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owox/connectors",
3
- "version": "0.13.0-next-20251118090139",
3
+ "version": "0.13.0-next-20251118102534",
4
4
  "description": "Connectors and storages for different data sources",
5
5
  "license": "MIT",
6
6
  "publishConfig": {