/// <inheritdoc/> public virtual async Task <HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken) { IHttpActionResult result = GetInnerActionResult(); var response = await result.ExecuteAsync(cancellationToken); ResultHelpers.AddServiceVersion(response, () => ResultHelpers.GetVersionString(Request)); return(response); }
/// <inheritdoc/> public async virtual Task ExecuteResultAsync(ActionContext context) { HttpResponse response = context.HttpContext.Response; HttpRequest request = context.HttpContext.Request; IActionResult result = GetInnerActionResult(request); await result.ExecuteResultAsync(context); ResultHelpers.AddServiceVersion(response, () => ResultHelpers.GetVersionString(request)); }
/// <inheritdoc/> public virtual async Task <HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken) { IHttpActionResult result = GetInnerActionResult(Request); HttpResponseMessage response = await result.ExecuteAsync(cancellationToken); response.Headers.Location = LocationHeader; ResultHelpers.AddEntityId(response, () => GenerateEntityId(Request)); ResultHelpers.AddServiceVersion(response, () => ResultHelpers.GetVersionString(Request)); return(response); }
/// <inheritdoc/> public async virtual Task ExecuteResultAsync(ActionContext context) { HttpRequest request = context.HttpContext.Request; HttpResponse response = context.HttpContext.Response; IActionResult result = GetInnerActionResult(request); response.Headers["Location"] = GenerateLocationHeader(request).ToString(); // Since AddEntityId relies on the response, make sure to execute the result // before calling AddEntityId() to ensure the response code is set correctly. await result.ExecuteResultAsync(context); ResultHelpers.AddEntityId(response, () => GenerateEntityId(request)); ResultHelpers.AddServiceVersion(response, () => ResultHelpers.GetVersionString(request)); }