Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

middleware chain is broken when found ctx.output #72

Merged
merged 1 commit into from
Nov 13, 2016
Merged

middleware chain is broken when found ctx.output #72

merged 1 commit into from
Nov 13, 2016

Conversation

osher
Copy link
Contributor

@osher osher commented Nov 9, 2016

I'm not sure about this - I need your eyes here.
If I'm on target - I'll add tests so you can merge.

.

I'm using restify, and I have other mw on the chain after the swagger_router.
(e.g server.on('after', restify.auditLogger(options.auditLogCfg)); )

I first noted that when I dont use json_error_handler - I get the audit entry on requests that error, and when I do - I dont get the desired log entries.
(e.g. - the 'after' event is not emitted - that suggests that the mw chain is broken)

Then I noted that they are emitted with defaultErrorHandler and are not emitted with json_error_handler because it creates ctx.output, where defaultErrorHandler does not.

The research led me to the corrected lines.
Let me know what you think.

I'm not sure about this - I need your eyes here.
If I'm on target - I'll add tests so you can merge.

I'm using restify, and I have other mw on the chain after the swagger_router.
(e.g `server.on('after', restify.auditLogger(options.auditLogCfg));` )

I first noted that when I dont use json_error_handler - I get the audit entry on requests that error, and when I do - I dont.
(e.g. - the 'after' event is not emitted)

The research led me to the corrected lines.
@coveralls
Copy link

coveralls commented Nov 9, 2016

Coverage Status

Coverage remained the same at 96.486% when pulling ac6dad9 on osher:patch-4 into 13498c9 on theganyo:master.

@osher
Copy link
Contributor Author

osher commented Nov 12, 2016

Scott - please take a look here...

Let me know what you think

@theganyo
Copy link
Collaborator

I think you're right. I believe the assumption was that this was the terminator on the chain. But even so, I don't believe the appropriate thing is to skip the next() call.

@theganyo theganyo merged commit d52ff58 into apigee-127:master Nov 13, 2016
@osher
Copy link
Contributor Author

osher commented Nov 13, 2016

that's great.
When can we expect 7.0.1?

@osher osher deleted the patch-4 branch November 13, 2016 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants