Skip to content

Commit

Permalink
fix: Write Headers to co response At send file (#523)
Browse files Browse the repository at this point in the history
fix: Write Headers to co response At send file
  • Loading branch information
inhere authored Oct 10, 2019
2 parents 6c6d104 + 0088434 commit 9d2a653
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/http-message/src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@ public function send(): void
if ($this->filePath) {
$this->sent = true;

// Write Headers to co response
foreach ($this->getHeaders() as $key => $value) {
$headerLine = implode(';', $value);

if ($key !== ContentType::KEY) {
$this->coResponse->header($key, $headerLine);
}
}

// Do send file
$this->coResponse->header(ContentType::KEY, $this->fileType);
$this->coResponse->sendfile($this->filePath);
Expand Down

0 comments on commit 9d2a653

Please sign in to comment.