From 6000e3ba163f53d4c9168500c68efc4ae564a2dd Mon Sep 17 00:00:00 2001 From: Lee Bradley Date: Tue, 17 Jan 2017 10:03:07 +0000 Subject: [PATCH] GridFieldAddExistingAutocompleter: Make Search Response HTTPResponse Also adds the 'text/json' Content-Type header --- src/Forms/GridField/GridFieldAddExistingAutocompleter.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Forms/GridField/GridFieldAddExistingAutocompleter.php b/src/Forms/GridField/GridFieldAddExistingAutocompleter.php index 5a1a66e5d..4c5051038 100644 --- a/src/Forms/GridField/GridFieldAddExistingAutocompleter.php +++ b/src/Forms/GridField/GridFieldAddExistingAutocompleter.php @@ -3,6 +3,7 @@ namespace SilverStripe\Forms\GridField; use SilverStripe\Control\HTTPRequest; +use SilverStripe\Control\HTTPResponse; use SilverStripe\Core\Config\Config; use SilverStripe\Core\Convert; use SilverStripe\Control\Controller; @@ -261,7 +262,9 @@ class GridFieldAddExistingAutocompleter implements GridField_HTMLProvider, GridF ); } Config::unnest(); - return Convert::array2json($json); + $response = new HTTPResponse(Convert::array2json($json)); + $response->addHeader('Content-Type', 'text/json'); + return $response; } /**