Example #1
0
 public function __construct(Hal $hal, $headers = [], $prettyPrint = true)
 {
     parent::__construct($hal, 201, $headers, $prettyPrint);
     if (!$this->headers->has('Location') && null !== ($url = $hal->getUri())) {
         $this->headers->set('Location', $url);
     }
 }
Example #2
0
 public function prepare(Request $request)
 {
     parent::prepare($request);
     if ('xml' === $request->getRequestFormat()) {
         $this->headers->set('Content-Type', 'application/vnd.error+xml');
     }
     return $this;
 }
Example #3
0
 protected function provideResponse(Hal $hal = null)
 {
     return HalResponse::create($hal ?: new Hal());
 }