Handle unicode in response properly
This commit is contained in:
parent
6729d98039
commit
5f985c36c0
@ -105,15 +105,21 @@ class GetController
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
$pagedCollection = $this->collectionsService->pageAndFilterCollection( $request, $object, $filterFunc );
|
$pagedCollection = $this->collectionsService->pageAndFilterCollection( $request, $object, $filterFunc );
|
||||||
|
return $this->makeJsonResponse( $pagedCollection );
|
||||||
return new JsonResponse( $pagedCollection );
|
|
||||||
}
|
}
|
||||||
$response = new JsonResponse( $object->asArray() );
|
$response = $this->makeJsonResponse( $object->asArray() );
|
||||||
if ( $object->hasField( 'type' ) &&
|
if ( $object->hasField( 'type' ) &&
|
||||||
$object['type'] === 'Tombstone' ) {
|
$object['type'] === 'Tombstone' ) {
|
||||||
$response->setStatusCode( 410 );
|
$response->setStatusCode( 410 );
|
||||||
}
|
}
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function makeJsonResponse( $obj )
|
||||||
|
{
|
||||||
|
$response = new Response( json_encode( $obj, JSON_UNESCAPED_UNICODE ) );
|
||||||
|
$response->headers->set( 'Content-Type', 'application/json' );
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user