1 write to HttpContext
Microsoft.AspNetCore.Grpc.JsonTranscoding (1)
Internal\JsonTranscodingServerCallContext.cs (1)
42HttpContext = httpContext;
31 references to HttpContext
Microsoft.AspNetCore.Grpc.JsonTranscoding (31)
Internal\CallHandlers\UnaryServerCallHandler.cs (1)
49await serverCallContext.HttpContext.Response.Body.WriteAsync(httpBody.Data.Memory);
Internal\HttpContextStreamWriter.cs (3)
51static (state) => ((JsonTranscodingServerCallContext)state!).HttpContext.Abort(), 89await _context.HttpContext.Response.Body.WriteAsync(httpBody.Data.Memory, cancellationToken); 97await _context.HttpContext.Response.Body.WriteAsync(GrpcProtocolConstants.StreamingDelimiter, cancellationToken);
Internal\JsonRequestHelpers.cs (9)
205GrpcServerLog.UnsupportedRequestContentType(serverCallContext.Logger, serverCallContext.HttpContext.Request.ContentType); 206throw new InvalidOperationException($"Unable to read the request as JSON because the request content type '{serverCallContext.HttpContext.Request.ContentType}' is not a known JSON content type."); 209var (stream, usesTranscodingStream) = GetStream(serverCallContext.HttpContext.Request.Body, serverCallContext.RequestEncoding); 282var routeValue = serverCallContext.HttpContext.Request.RouteValues[parameterDescriptor.Key]; 289foreach (var item in serverCallContext.HttpContext.Request.Query) 322var contentType = serverCallContext.HttpContext.Request.ContentType; 341var contentLength = serverCallContext.HttpContext.Request.ContentLength.GetValueOrDefault(); 348using var fs = new FileBufferingReadStream(serverCallContext.HttpContext.Request.Body, memoryThreshold); 373var response = serverCallContext.HttpContext.Response;
Internal\JsonTranscodingServerCallContext.cs (18)
51IsJsonRequestContent = JsonRequestHelpers.HasJsonContentType(HttpContext.Request, out var charset); 57HttpContext.Items["__HttpContext"] = HttpContext; 64protected override string HostCore => HttpContext.Request.Host.Value ?? string.Empty; 82var connection = HttpContext.Connection; 129await JsonRequestHelpers.SendErrorResponse(HttpContext.Response, RequestEncoding, ResponseTrailers, status, options); 132await HttpContext.Response.Body.WriteAsync(GrpcProtocolConstants.StreamingDelimiter); 147foreach (var header in HttpContext.Request.Headers) 170protected override CancellationToken CancellationTokenCore => HttpContext.RequestAborted; 188var clientCertificate = HttpContext.Connection.ClientCertificate; 199protected override IDictionary<object, object> UserStateCore => HttpContext.Items!; 209if (HttpContext.Response.HasStarted) 220HttpContext.Response.Headers[entry.Key] = Convert.ToBase64String(entry.ValueBytes); 224HttpContext.Response.Headers[entry.Key] = entry.Value; 231return HttpContext.Response.BodyWriter.FlushAsync().GetAsTask(); 236if (!HttpContext.Response.HasStarted) 238HttpContext.Response.StatusCode = StatusCodes.Status200OK; 239HttpContext.Response.ContentType = contentType ?? MediaType.ReplaceEncoding("application/json", RequestEncoding);