Created
June 4, 2014 15:17
-
-
Save jokecamp/f8ca5ea84a1aafe1c76b to your computer and use it in GitHub Desktop.
ServiceStack v3.9.55.0 - Dynamically add OPTIONS to all routes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Call this ad the end of your app host Configure(Funq.Container container) method | |
private void AddOptionsVerbToAllRoutes(IServiceRoutes routes) | |
{ | |
var map = EndpointHost.ServiceManager.ServiceController.RestPathMap; | |
foreach (var key in map.Keys) | |
{ | |
foreach (RestPath rp in map[key]) | |
{ | |
routes.Add(rp.RequestType, rp.Path, "OPTIONS"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment