Skip to content

Instantly share code, notes, and snippets.

@jokecamp
Created June 4, 2014 15:17
Show Gist options
  • Save jokecamp/f8ca5ea84a1aafe1c76b to your computer and use it in GitHub Desktop.
Save jokecamp/f8ca5ea84a1aafe1c76b to your computer and use it in GitHub Desktop.
ServiceStack v3.9.55.0 - Dynamically add OPTIONS to all routes
/// 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