mirror of
https://github.com/flarum/framework.git
synced 2025-02-03 03:57:54 +08:00
3ff230dc26
This required some interface changes (mostly changing Laravel's or Symfony's request and response classes to those of Zend's Diactoros. Some smaller changes to the execution flow in a few of the abstract action base classes, but nothing substantial. Note: The request and response classes are immutable, so we usually need to return new instances after modifying the old ones.
15 lines
340 B
PHP
15 lines
340 B
PHP
<?php namespace Flarum\Api;
|
|
|
|
use Tobscure\JsonApi\Document;
|
|
use Zend\Diactoros\Response;
|
|
|
|
class JsonApiResponse extends Response
|
|
{
|
|
public function __construct(Document $document)
|
|
{
|
|
parent::__construct('php://memory', 200, ['content-type' => 'application/vnd.api+json']);
|
|
|
|
$this->getBody()->write($document);
|
|
}
|
|
}
|