@hyper-fetch/core 5.1.1 → 5.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyper-fetch/core",
3
- "version": "5.1.1",
3
+ "version": "5.1.2",
4
4
  "private": false,
5
5
  "description": "Cache, Queue and Persist your requests no matter if you are online or offline!",
6
6
  "author": "Maciej Pyrc <m.pyrc@interia.pl>",
@@ -57,6 +57,7 @@ export const getAdapterBindings = async <T extends AdapterInstance = AdapterType
57
57
  const { client, abortKey, queueKey, endpoint, data } = request;
58
58
 
59
59
  const fullUrl = url + endpoint;
60
+
60
61
  const effects = client.effects.filter((effect) => request.effectKey === effect.getEffectKey());
61
62
  const headers = headerMapper(request);
62
63
  let payload = data;
@@ -26,7 +26,6 @@ export const adapter: AdapterType = async (request, requestId) => {
26
26
  const { method = HttpMethodsEnum.get, client } = request;
27
27
  const httpClient = client.url.includes("https://") ? https : http;
28
28
  const options = {
29
- path: fullUrl,
30
29
  method,
31
30
  headers: headers as OutgoingHttpHeaders,
32
31
  timeout: defaultTimeout,
@@ -43,8 +42,10 @@ export const adapter: AdapterType = async (request, requestId) => {
43
42
  options.headers["Content-Length"] = Buffer.byteLength(JSON.stringify(payload));
44
43
  }
45
44
 
45
+ const requestUrl = !fullUrl.startsWith("http") ? `http://${fullUrl}` : fullUrl;
46
+
46
47
  return makeRequest((resolve) => {
47
- const httpRequest = httpClient.request(options, (response) => {
48
+ const httpRequest = httpClient.request(requestUrl, options, (response) => {
48
49
  response.setEncoding("utf8");
49
50
  unmountListener = createAbortListener(0, xhrExtra, response.destroy, resolve);
50
51