public async Task ProcessRequestAsync(HttpListenerHost appHost, IRequest httpReq, IResponse httpRes, ILogger logger, string operationName, CancellationToken cancellationToken) { var restPath = GetRestPath(httpReq.Verb, httpReq.PathInfo); if (restPath == null) { throw new NotSupportedException("No RestPath found for: " + httpReq.Verb + " " + httpReq.PathInfo); } SetRoute(httpReq, restPath); if (ResponseContentType != null) { httpReq.ResponseContentType = ResponseContentType; } var request = httpReq.Dto = await CreateRequest(appHost, httpReq, restPath, logger).ConfigureAwait(false); appHost.ApplyRequestFilters(httpReq, httpRes, request); var response = await appHost.ServiceController.Execute(appHost, request, httpReq).ConfigureAwait(false); FilterResponse(httpReq, httpRes, response); await ResponseHelper.WriteToResponse(httpRes, httpReq, response, cancellationToken).ConfigureAwait(false); }
public async Task ProcessRequestAsync(HttpListenerHost httpHost, IRequest httpReq, HttpResponse httpRes, ILogger logger, CancellationToken cancellationToken) { httpReq.Items["__route"] = _restPath; if (_responseContentType != null) { httpReq.ResponseContentType = _responseContentType; } var request = await CreateRequest(httpHost, httpReq, _restPath, logger).ConfigureAwait(false); httpHost.ApplyRequestFilters(httpReq, httpRes, request); var response = await httpHost.ServiceController.Execute(httpHost, request, httpReq).ConfigureAwait(false); // Apply response filters foreach (var responseFilter in httpHost.ResponseFilters) { responseFilter(httpReq, httpRes, response); } await ResponseHelper.WriteToResponse(httpRes, httpReq, response, cancellationToken).ConfigureAwait(false); }