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