GridFieldAddExistingAutocompleter: Make Search Response HTTPResponse

Also adds the 'text/json' Content-Type header
This commit is contained in:
Lee Bradley 2017-01-17 10:03:07 +00:00
parent d192a4f86f
commit 6000e3ba16

View File

@ -3,6 +3,7 @@
namespace SilverStripe\Forms\GridField; namespace SilverStripe\Forms\GridField;
use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\HTTPResponse;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
@ -261,7 +262,9 @@ class GridFieldAddExistingAutocompleter implements GridField_HTMLProvider, GridF
); );
} }
Config::unnest(); Config::unnest();
return Convert::array2json($json); $response = new HTTPResponse(Convert::array2json($json));
$response->addHeader('Content-Type', 'text/json');
return $response;
} }
/** /**