Fix issue with API header binding when running under a subdirectory #478

Closed
wants to merge 1 commit into
from
@@ -10,7 +10,7 @@ public override IValueProvider GetValueProvider(ControllerContext controllerCont
var request = controllerContext.RequestContext.HttpContext.Request;
// Use this value provider only if a route is located under "API"
- if (request.Path.TrimStart('/').StartsWith("api", StringComparison.OrdinalIgnoreCase))
+ if (request.Path.Contains("/api/"))
@pranavkm

pranavkm Apr 19, 2012

Member

I think it might be safe to use the Controller as the discriminator. We could do:
if (controllerContext.Controller is ApiController)
{
// ...
}

@Daniel15

Daniel15 Apr 19, 2012

Contributor

Ah, that's an even better idea.

return new HttpHeaderValueProvider(request, "ApiKey");
return null;
}