From 5737cdfbe271efb55a11f428ea886206d57bb25e Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 19 Mar 2015 12:03:55 +1100 Subject: [PATCH] Fixes the way HttpResponseMessages are created - they should always be created with Request.CreateReponse! --- .../Editors/CanvasDesignerController.cs | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/Umbraco.Web/Editors/CanvasDesignerController.cs b/src/Umbraco.Web/Editors/CanvasDesignerController.cs index 17dfbe7ab5..722167d18a 100644 --- a/src/Umbraco.Web/Editors/CanvasDesignerController.cs +++ b/src/Umbraco.Web/Editors/CanvasDesignerController.cs @@ -40,10 +40,8 @@ namespace Umbraco.Web.Editors response = client.DownloadString(new Uri(googleWebFontAPIURL)); } - var resp = new HttpResponseMessage() - { - Content = new StringContent(response) - }; + var resp = Request.CreateResponse(); + resp.Content = new StringContent(response); resp.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); return resp; @@ -69,10 +67,8 @@ namespace Umbraco.Web.Editors } // Response - var resp = new HttpResponseMessage() - { - Content = new StringContent("{" + String.Join(",", parameters) + "}") - }; + var resp = Request.CreateResponse(); + resp.Content = new StringContent("{" + String.Join(",", parameters) + "}"); resp.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); return resp; } @@ -89,10 +85,8 @@ namespace Umbraco.Web.Editors // Save and compile styles CanvasDesignerUtility.SaveAndPublishStyle(parameters, pageId, inherited); - var resp = new HttpResponseMessage() - { - Content = new StringContent("ok") - }; + var resp = Request.CreateResponse(); + resp.Content = new StringContent("ok"); resp.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); return resp; @@ -106,10 +100,8 @@ namespace Umbraco.Web.Editors CanvasDesignerUtility.DeleteStyle(int.Parse(pageId)); - var resp = new HttpResponseMessage() - { - Content = new StringContent("ok") - }; + var resp = Request.CreateResponse(); + resp.Content = new StringContent("ok"); resp.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); return resp;