Skip to content

Commit 21be50d

Browse files
committed
fix: get cookie
1 parent af7eb5c commit 21be50d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/helpers/withState.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class withState {
1717
this.req.getHeaders = this.getHeaders.bind(this)
1818
this.req.getQuery = this.getQuery.bind(this)
1919
this.req.getParams = this.getParams.bind(this)
20+
this.req.getCookies = this.getCookies.bind(this)
2021
this.req.getBody = this.getBody.bind(this)
2122
this.req.setBody = this.setBody.bind(this)
2223
this.req.getSingleArrayFile = this.getSingleArrayFile.bind(this)
@@ -47,6 +48,10 @@ class withState {
4748
return get(this.req.state, path, defaultValue)
4849
}
4950

51+
getCookies(path?: any, defaultValue?: any): any {
52+
return getterObject(this.req.cookies, path, defaultValue)
53+
}
54+
5055
getBody(path?: any, defaultValue?: any): any {
5156
return getterObject(this.req.body, path, defaultValue)
5257
}

0 commit comments

Comments
 (0)