Add utf8 charset in content-type and update tests

This commit is contained in:
Maurits van der Schee 2016-04-15 23:10:11 +02:00
commit 0995e010c1
2 changed files with 4 additions and 3 deletions

View file

@ -932,12 +932,12 @@ class PHP_CRUD_API {
protected function startOutput($callback) {
if ($callback) {
if (isset($_SERVER['REQUEST_METHOD'])) {
header('Content-Type: application/javascript');
header('Content-Type: application/javascript; charset=utf-8');
}
echo $callback.'(';
} else {
if (isset($_SERVER['REQUEST_METHOD'])) {
header('Content-Type: application/json');
header('Content-Type: application/json; charset=utf-8');
}
}
}
@ -1603,6 +1603,7 @@ class PHP_CRUD_API {
$tables = array_merge(array_filter($tables));
//var_dump($tables);die();
header('Content-Type: application/json; charset=utf-8');
echo '{"swagger":"2.0",';
echo '"info":{';
echo '"title":"'.$database.'",';

View file

@ -390,7 +390,7 @@ class PHP_CRUD_API_Test extends PHPUnit_Framework_TestCase
{
$test = new API($this);
$test->options('/posts/2');
$test->expect('["Access-Control-Allow-Headers: Content-Type","Access-Control-Allow-Methods: OPTIONS, GET, PUT, POST, DELETE","Access-Control-Max-Age: 1728000"]',false);
$test->expect('["Access-Control-Allow-Headers: Content-Type","Access-Control-Allow-Methods: OPTIONS, GET, PUT, POST, DELETE","Access-Control-Allow-Credentials: true","Access-Control-Max-Age: 1728000"]',false);
}
public function testHidingPasswordColumn()