Skip to content

Commit

Permalink
Merge pull request #46 from jkyberneees/supporting-originalurl
Browse files Browse the repository at this point in the history
Supporting req.originalurl
  • Loading branch information
jkyberneees authored Jun 21, 2019
2 parents a006570 + acdb6bf commit 4884dc9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ declare namespace restana {

interface RequestExtensions {
params: Record<string, string>
originalUrl: string
}

type Request<P extends Protocol> = P extends Protocol.HTTP2
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ module.exports = (options = {}) => {
// registering 'request' handler
if (prp) {
server.on('request', (req, res) => {
req.originalUrl = req.url
setImmediate(() => app.handle(req, res))
})
} else {
server.on('request', (req, res) => {
req.originalUrl = req.url
app.handle(req, res)
})
}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "restana",
"version": "3.1.1",
"version": "3.2.0",
"description": "Super fast and minimalist web framework for building REST micro-services.",
"main": "index.js",
"types": "index.d.ts",
Expand Down

0 comments on commit 4884dc9

Please sign in to comment.