Skip to content
This repository has been archived by the owner on Jan 24, 2021. It is now read-only.

Break when status code has been handled #1668

Merged
merged 2 commits into from
Aug 19, 2015

Conversation

khellang
Copy link
Member

Fixes #1667. I don't think it makes sense to run through all status code handlers even after one has been called. This will try to find a custom handler and fall back on the DefaultStatusCodeHandler if no custom handler is found.

@khellang khellang changed the title Break when status code handler is finished Break when status code has been handled Aug 31, 2014
@khellang
Copy link
Member Author

This could potentially be a breaking change if people rely on multiple status code handlers to handle a specific status code. It's a weird edge case, though.

.FirstOrDefault(x => !(x is DefaultStatusCodeHandler));

var handler = customHandler ?? defaultHandler;
if (handler == null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will never be null?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the DefaultStatusCodeHandler has been removed, it could be null. Better safe than sorry 😉

@thecodejunkie thecodejunkie added this to the 1.3 milestone Aug 19, 2015
@khellang khellang force-pushed the single-status-code-handler branch from 7f57b20 to 7bac92f Compare August 19, 2015 13:20
thecodejunkie added a commit that referenced this pull request Aug 19, 2015
Break when status code has been handled
@thecodejunkie thecodejunkie merged commit bdc5cf4 into NancyFx:master Aug 19, 2015
@khellang khellang deleted the single-status-code-handler branch August 19, 2015 13:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom IStatusCodeHandler's response gets overriden by DefaultStatusCodeHandler's Response
3 participants