public static IEnumerable <IHttpPathHandler> CreatePathHandlers(IHttpPathHandlerFactory pathHandlerFactory, IPayloadSerializer payloadSerializer, IConfiguration configuration) { // Use Configuration. var restResponseFactory = new RestResponseFactory(); var templatePathHandler = new TemplatePathHandler(restResponseFactory); return(new List <IHttpPathHandler> { pathHandlerFactory.CreateHttpPathHandler("template/path", templatePathHandler.VerbHandlers) }); }
public void Init() { _successfulPathHandlers = new List <IHttpPathHandler> { _pathHandlerFactory.CreateHttpPathHandler("v1/fulfilleditems", new Dictionary <HttpVerb, Func <RestRequest, ILogger, Task <RestResponse> > > { { HttpVerb.Post, _postFulfilledItemAsync } }), _pathHandlerFactory.CreateHttpPathHandler("v1/fulfilleditems/{id}", new Dictionary <HttpVerb, Func <RestRequest, ILogger, Task <RestResponse> > > { { HttpVerb.Get, _getFulfilledItemAsync } }) }; _noMatchingHandlerPathHandlers = _successfulPathHandlers; _throwingPathHandlers = new List <IHttpPathHandler> { _pathHandlerFactory.CreateHttpPathHandler("throw/exception", new Dictionary <HttpVerb, Func <RestRequest, ILogger, Task <RestResponse> > > { { HttpVerb.Get, _exceptionThrowingVerbHandler } }) }; }