Skip to content

Commit db17f46

Browse files
authored
Merge pull request #613 from crysadrak/cnsqa-1722
feat: add getMethod and getRequest methods to Request class; add getR…
2 parents 2bf239e + 3a43baf commit db17f46

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

.changeset/sharp-poems-wait.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@ima/core": patch
3+
---
4+
5+
add getMethod and getRequest methods to Request class; add getResponse method to Response class
6+
7+

packages/core/src/router/Request.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,18 @@ export class Request {
9191
return this._request ? this._request.ips || [] : [];
9292
}
9393

94+
/**
95+
* Returns the HTTP method of the request.
96+
*/
9497
getMethod() {
9598
return this._request ? this._request.method : '';
9699
}
100+
101+
/**
102+
* Returns the raw request.
103+
*/
104+
getRequest(): ExpressRequest | undefined {
105+
return this._request;
106+
}
97107
}
98108
// @endif

packages/core/src/router/Response.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,5 +175,12 @@ export class Response {
175175
headers: this._internalHeadersStorage,
176176
};
177177
}
178+
179+
/**
180+
* Returns the ExpressJS response object.
181+
*/
182+
getResponse(): ExpressResponse | undefined {
183+
return this._response;
184+
}
178185
}
179186
// @endif

0 commit comments

Comments
 (0)