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

Prevent OPTIONS route clobber #1093

Merged
merged 2 commits into from
May 21, 2013
Merged

Prevent OPTIONS route clobber #1093

merged 2 commits into from
May 21, 2013

Conversation

smithjacobj
Copy link

Moved the IsOptionsRequest conditional branch to only execute if no
defined OPTIONS route for the context exists. Otherwise, even if you
define an OPTIONS route manually, the auto-OPTIONS conditional clobbers
the Response, preventing custom additions such as CORS headers.

Addresses discussion at 604327a#commitcomment-3148154

Moved the IsOptionsRequest conditional branch to only execute if no
defined OPTIONS route for the context exists. Otherwise, even if you
define an OPTIONS route manually, the auto-OPTIONS conditional clobbers
the Response, preventing custom additions such as CORS headers.
var results = this.trie.GetMatches(GetMethod(context), context.Request.Path, context);

if (!results.Any())
{
if (this.IsOptionsRequest(context))
Copy link
Member

Choose a reason for hiding this comment

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

Indentation is all screwey.

Copy link
Author

Choose a reason for hiding this comment

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

Gotcha. Looks like VS decided tabs was the way to go. I'll fix it.

@thecodejunkie
Copy link
Member

As soon as we've reviewed and pulled in this, then you can use the CI nugets which always reflects master http://www.myget.org/gallery/nancyfx

grumpydev added a commit that referenced this pull request May 21, 2013
@grumpydev grumpydev merged commit 073f7ce into NancyFx:master May 21, 2013
@smithjacobj smithjacobj deleted the Options-Route-Fix branch May 21, 2013 13:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants