-
Notifications
You must be signed in to change notification settings - Fork 19
/
node.ts
40 lines (36 loc) · 977 Bytes
/
node.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { Request } from "servie/dist/node";
import { compose } from "throwback";
import { transport, HttpResponse } from "popsicle-transport-http";
import { cookies } from "popsicle-cookie-jar";
import { contentEncoding } from "popsicle-content-encoding";
import { redirects } from "popsicle-redirects";
import { userAgent } from "popsicle-user-agent";
import { toFetch } from "./common";
export * from "./common";
export * from "servie/dist/signal";
export * from "servie/dist/headers";
/**
* Expose node.js components.
*/
export {
contentEncoding,
cookies,
HttpResponse,
redirects,
Request,
transport,
userAgent,
};
/**
* Node.js standard middleware stack.
*/
export const middleware = compose<Request, HttpResponse>([
userAgent(),
contentEncoding(),
// Redirects must happen around cookie support.
redirects(compose([cookies(), transport()])),
]);
/**
* Standard node.js fetch interface.
*/
export const fetch = toFetch(middleware, Request);