@hyper-fetch/core 3.0.0 → 3.0.1
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.js +1 -1
- package/dist/index.cjs.js.map +3 -3
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +3 -3
- package/package.json +1 -1
- package/src/adapter/adapter.server.ts +10 -6
package/package.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import http from "http";
|
|
2
|
-
import stream from "stream";
|
|
3
|
-
|
|
4
1
|
import { getAdapterBindings, defaultTimeout, ResponseType, AdapterType, AdapterOptionsType } from "adapter";
|
|
5
2
|
import { parseErrorResponse, parseResponse, getUploadSize, getStreamPayload } from "./adapter.utils";
|
|
6
3
|
|
|
7
4
|
export const serverAdapter: AdapterType = async (request, requestId) => {
|
|
5
|
+
/**
|
|
6
|
+
* Prevent issues related to the missing Node.js polyfills
|
|
7
|
+
*/
|
|
8
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
9
|
+
const http = require("http");
|
|
10
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
11
|
+
const stream = require("stream");
|
|
12
|
+
|
|
8
13
|
const {
|
|
9
14
|
fullUrl,
|
|
10
15
|
headers,
|
|
@@ -22,15 +27,14 @@ export const serverAdapter: AdapterType = async (request, requestId) => {
|
|
|
22
27
|
onError,
|
|
23
28
|
onResponseEnd,
|
|
24
29
|
} = await getAdapterBindings<AdapterOptionsType>(request, requestId);
|
|
25
|
-
|
|
26
30
|
const { method } = request;
|
|
27
31
|
|
|
28
32
|
return new Promise<ResponseType<unknown, unknown>>((resolve) => {
|
|
29
33
|
const execute = async () => {
|
|
30
|
-
const options
|
|
34
|
+
const options = {
|
|
31
35
|
path: fullUrl,
|
|
32
36
|
method,
|
|
33
|
-
headers
|
|
37
|
+
headers,
|
|
34
38
|
timeout: defaultTimeout,
|
|
35
39
|
};
|
|
36
40
|
|