Skip to content

Commit 29204ab

Browse files
authored
Add cookies property to the InjectOptions interface type definition (#74)
* Add cookies property to the InjectOptions interface type definition * Add type unit test to InjectOptions cookies property
1 parent 150ab0b commit 29204ab

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ declare namespace LightMyRequest {
5757
validate?: boolean
5858
payload?: InjectPayload
5959
server?: http.Server
60+
cookies?: { [k: string]: string }
6061
}
6162

6263
interface Request extends stream.Readable {

test/index.test-d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ inject(dispatch, { method: 'get', url: '/' }, (err, res) => {
2222
console.log(res.cookies)
2323
})
2424

25+
inject(dispatch, { method: 'get', url: '/', cookies: { name1: 'value1', value2: 'value2' } }, (err, res) => {
26+
expectType<Error>(err)
27+
expectType<Response>(res)
28+
console.log(res.payload)
29+
expectType<Function>(res.json)
30+
console.log(res.cookies)
31+
})
32+
2533
inject(dispatch)
2634
.get('/')
2735
.end((err, res) => {

0 commit comments

Comments
 (0)