/// <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)); 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)); }
/// <inheritdoc/> public async virtual Task ExecuteResultAsync(ActionContext context) { HttpRequest request = context.HttpContext.Request; HttpResponse response = context.HttpContext.Response; IActionResult result = GetInnerActionResult(request); Uri location = GenerateLocationHeader(request); response.Headers["Location"] = location.AbsoluteUri; // 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, () => ODataUtils.ODataVersionToString(ResultHelpers.GetODataResponseVersion(request))); }