Skip to content

Commit 61feb7a

Browse files
committed
fix: update route handling and headers type definition in server and http client modules
1 parent ffdefce commit 61feb7a

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

devserver/server.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const client = new Client(
3939
);
4040

4141
// Serve HTML
42-
app.get('/*', async (req, res) => {
42+
app.get('/{*path}', async (req, res) => {
4343
try {
4444
const cookieHandler: CookieHandlerInterface = {
4545
get: (key: string) => {

src/libs/http-client.module.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,13 @@ type BodyInit =
99
| null
1010
| string;
1111

12-
type HeadersInit =
13-
| string[][]
14-
| Record<string, string | ReadonlyArray<string>>
15-
| Headers;
12+
type HeadersInit = [string, string][] | Record<string, string> | Headers;
1613

1714
const request = async <TRESPONSE, TBODY extends BodyInit | undefined>(
1815
method: string,
1916
url: string,
2017
body?: TBODY,
21-
headers?: HeadersInit
18+
headers?: HeadersInit,
2219
): Promise<TRESPONSE> => {
2320
const response = await fetch(url, {
2421
method,
@@ -40,15 +37,15 @@ const get = <TRESPONSE>(url: string, headers?: any) => {
4037
const post = <TRESPONSE, TBODY extends BodyInit>(
4138
url: string,
4239
body: TBODY,
43-
headers?: any
40+
headers?: any,
4441
) => {
4542
return request<TRESPONSE, TBODY>("POST", url, body, headers);
4643
};
4744

4845
const put = <TRESPONSE, TBODY extends BodyInit>(
4946
url: string,
5047
body: any,
51-
headers?: any
48+
headers?: any,
5249
) => {
5350
return request<TRESPONSE, TBODY>("PUT", url, body, headers);
5451
};

0 commit comments

Comments
 (0)