Exemple #1
0
        private static void SetLocationHeader(Response response, object newIdentifier)
        {
            Debug.Assert(newIdentifier != null, "New identifier cannot be null.");

            var    urlCalculator = new UrlCalculator(response.ResourcePath);
            string newUrl        = urlCalculator.GetCreatedUrl(newIdentifier);

            response.Headers["Location"] = newUrl;
        }
Exemple #2
0
 public void AddResource(Response response, ResourceBody resourceBody)
 {
     if (resourceBody is IPagedResourceBody pagedResourceBody)
     {
         var urlCalculator = new UrlCalculator(response.ResourcePath);
         var setter        = new LinkHeaderBuilder(urlCalculator);
         setter.AddDetails(pagedResourceBody.PageLinks);
         setter.SetHeaders(response);
     }
 }