Skip to content

Commit 5fbe45b

Browse files
committed
feat: methods
1 parent 6352d2a commit 5fbe45b

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

src/socket/method.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* This array represents all possible methods for a request.
3+
*/
4+
export const method = [
5+
'GET',
6+
'HEAD',
7+
'POST',
8+
'PUT',
9+
'DELETE',
10+
'CONNECT',
11+
'OPTIONS',
12+
'TRACE',
13+
'PATCH'
14+
] as const;
15+
16+
/**
17+
* This type represents possible methods
18+
*/
19+
export type Method = typeof method[number];

src/socket/socket.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export class Socket {
4949
return;
5050
}
5151

52-
const text = new TextDecoder().decode(value, { stream: true });
52+
const text = new TextDecoder().decode(value, {stream: true});
5353
leftover += text;
5454

5555
if (!headerParsed) {

src/socket/socket_init_options.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import { Method } from './method.ts';
2+
13
export interface SocketInitOptions {
2-
method? : 'GET' | 'PUT' | 'POST',
4+
method? : Method,
35
headers : Record<string, string>
46
}

0 commit comments

Comments
 (0)