public Task HandleCallAsync(HttpContext httpContext) { if (GrpcProtocolHelpers.IsInvalidContentType(httpContext, out var error)) { GrpcProtocolHelpers.SendHttpError(httpContext.Response, StatusCodes.Status415UnsupportedMediaType, StatusCode.Internal, error !); return(Task.CompletedTask); } var serverCallContext = new HttpContextServerCallContext(httpContext, ServiceOptions, Logger); httpContext.Features.Set <IServerCallContextFeature>(serverCallContext); GrpcProtocolHelpers.AddProtocolHeaders(httpContext.Response); try { serverCallContext.Initialize(); var handleCallTask = HandleCallAsyncCore(httpContext, serverCallContext); if (handleCallTask.IsCompletedSuccessfully) { return(serverCallContext.EndCallAsync()); } else { return(AwaitHandleCall(serverCallContext, Method, handleCallTask)); } } catch (Exception ex) { return(serverCallContext.ProcessHandlerErrorAsync(ex, Method.Name)); }
public Task HandleCallAsync(HttpContext httpContext) { if (!GrpcProtocolHelpers.IsValidContentType(httpContext, out var error)) { return(GrpcProtocolHelpers.SendHttpError(httpContext.Response, StatusCode.Internal, error)); } return(HandleCallAsyncCore(httpContext)); }
public Task HandleCallAsync(HttpContext httpContext) { if (!GrpcProtocolHelpers.IsValidContentType(httpContext, out var error)) { GrpcProtocolHelpers.SendHttpError(httpContext.Response, StatusCodes.Status415UnsupportedMediaType, StatusCode.Internal, error); return(Task.CompletedTask); } return(HandleCallAsyncCore(httpContext)); }