コード例 #1
0
ファイル: HeaderBagTest.php プロジェクト: renyinew/blink
 public function testBasic()
 {
     $bag = new HeaderBag(['CONTENT_TYPE' => 'application/json', 'Accept' => 'application/json']);
     $this->assertEquals(['application/json'], $bag->get('Content-Type'));
     $this->assertEquals('application/json', $bag->first('Content-Type'));
     $bag->with('Content-Type', 'foo');
     $this->assertEquals(['application/json', 'foo'], $bag->get('Content-Type'));
 }
コード例 #2
0
ファイル: Response.php プロジェクト: nosun/blink
 /**
  * Prepare the response to ready to send to client.
  */
 public function prepare()
 {
     if (!$this->prepared) {
         $this->content = is_string($this->data) ? $this->data : Json::encode($this->data);
         if (!is_string($this->data)) {
             $this->headers->set('Content-Type', 'application/json');
         }
         $this->prepared = true;
     }
 }