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

wants to merge 1 commit into
@@ -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 Apr 19, 2012


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


Daniel15 Apr 19, 2012


Ah, that's an even better idea.

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