8000 add 'stack' property to REQUEST · jthomerson/lambda-api@125993b · GitHub
[go: up one dir, main page]

Skip to content

Commit 125993b

Browse files
committed
add 'stack' property to REQUEST
1 parent 34bb29b commit 125993b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/request.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ class REQUEST {
170170
this.body = UTILS.parseBody(this.body)
171171
}
172172

173+
// Init the stack reporter
174+
this.stack = null
175+
173176
// Extract path from event (strip querystring just in case)
174177
let path = UTILS.parsePath(this.path)
175178

@@ -236,6 +239,9 @@ class REQUEST {
236239
// Set the execution stack
237240
this._stack = route.inherited.concat(route.stack)
238241

242+
// Set the stack reporter
243+
this.stack = this._stack.map(x => x.name.trim() !== '' ? x.name : 'unnamed')
244+
239245
} else {
240246
this.app._errorStatus = 405
241247
throw new MethodError('Method not allowed',this.method,'/'+path.join('/'))

0 commit comments

Comments
 (0)
0