mirror of
https://github.com/denoland/deno.git
synced 2025-10-02 23:24:37 +00:00
refactor(std/http): move io functions to http/io.ts (#4126)
This commit is contained in:
parent
9a8d6fbd98
commit
942e67c00b
10 changed files with 667 additions and 691 deletions
26
std/http/mock.ts
Normal file
26
std/http/mock.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
/** Create dummy Deno.Conn object with given base properties */
|
||||
export function mockConn(base: Partial<Deno.Conn> = {}): Deno.Conn {
|
||||
return {
|
||||
localAddr: {
|
||||
transport: "tcp",
|
||||
hostname: "",
|
||||
port: 0
|
||||
},
|
||||
remoteAddr: {
|
||||
transport: "tcp",
|
||||
hostname: "",
|
||||
port: 0
|
||||
},
|
||||
rid: -1,
|
||||
closeRead: (): void => {},
|
||||
closeWrite: (): void => {},
|
||||
read: async (): Promise<number | Deno.EOF> => {
|
||||
return 0;
|
||||
},
|
||||
write: async (): Promise<number> => {
|
||||
return -1;
|
||||
},
|
||||
close: (): void => {},
|
||||
...base
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue