public IActionResult GetDeployResults() { IActionResult result; EntityTagHeaderValue currentEtag = null; DeploymentsCacheItem cachedDeployments = _cachedDeployments; using (_tracer.Step("DeploymentService.GetCurrentEtag")) { currentEtag = GetCurrentEtag(Request); _tracer.Trace("Current Etag: {0}, Cached Etag: {1}", currentEtag, cachedDeployments.Etag); } if (EtagEquals(Request, currentEtag)) { result = StatusCode(StatusCodes.Status304NotModified); } else { using (_tracer.Step("DeploymentService.GetDeployResults")) { if (!currentEtag.Equals(cachedDeployments.Etag)) { cachedDeployments = new DeploymentsCacheItem { Results = GetResults(Request).ToList(), Etag = currentEtag }; _cachedDeployments = cachedDeployments; } result = Ok(ArmUtils.AddEnvelopeOnArmRequest(cachedDeployments.Results, Request)); } } // CORE TODO Make sure this works properly // return etag //response.Headers.ETag = currentEtag; Response.GetTypedHeaders().ETag = currentEtag; return(result); }
public HttpResponseMessage GetDeployResults() { HttpResponseMessage response; EntityTagHeaderValue currentEtag = null; DeploymentsCacheItem cachedDeployments = _cachedDeployments; using (_tracer.Step("DeploymentService.GetCurrentEtag")) { currentEtag = GetCurrentEtag(Request); _tracer.Trace("Current Etag: {0}, Cached Etag: {1}", currentEtag, cachedDeployments.Etag); } if (EtagEquals(Request, currentEtag)) { response = Request.CreateResponse(HttpStatusCode.NotModified); } else { using (_tracer.Step("DeploymentService.GetDeployResults")) { if (!currentEtag.Equals(cachedDeployments.Etag)) { cachedDeployments = new DeploymentsCacheItem { Results = GetResults(Request).ToList(), Etag = currentEtag }; _cachedDeployments = cachedDeployments; } response = Request.CreateResponse(HttpStatusCode.OK, ArmUtils.AddEnvelopeOnArmRequest(cachedDeployments.Results, Request)); } } // return etag response.Headers.ETag = currentEtag; return(response); }
public HttpResponseMessage GetDeployResults() { HttpResponseMessage response; EntityTagHeaderValue currentEtag = null; DeploymentsCacheItem cachedDeployments = _cachedDeployments; using (_tracer.Step("DeploymentService.GetCurrentEtag")) { currentEtag = GetCurrentEtag(Request); _tracer.Trace("Current Etag: {0}, Cached Etag: {1}", currentEtag, cachedDeployments.Etag); } if (EtagEquals(Request, currentEtag)) { response = Request.CreateResponse(HttpStatusCode.NotModified); } else { using (_tracer.Step("DeploymentService.GetDeployResults")) { if (!currentEtag.Equals(cachedDeployments.Etag)) { cachedDeployments = new DeploymentsCacheItem { Results = GetResults(Request).ToList(), Etag = currentEtag }; _cachedDeployments = cachedDeployments; } response = Request.CreateResponse(HttpStatusCode.OK, ArmUtils.AddEnvelopeOnArmRequest(cachedDeployments.Results, Request)); } } // return etag response.Headers.ETag = currentEtag; return response; }