如果没有返回Content-Type 默认

develop
JING 2 weeks ago
parent 13a60ae4aa
commit 932ca47754
  1. 4
      src/http/Response.php

@ -29,7 +29,9 @@ class Response
if(!empty($self->source)) { if(!empty($self->source)) {
$contentType = $response->getHeader('Content-Type'); $contentType = $response->getHeader('Content-Type');
if(empty($contentType)) { if(empty($contentType)) {
throw new ApiException('反馈的消息未指明内容格式Content-Type'); //throw new ApiException('反馈的消息未指明内容格式Content-Type');
//如果没有默认为这个
$contentType[0] = 'application/json; charset=utf-8';
} }
$bodyFormat = explode(';', $contentType[0]); $bodyFormat = explode(';', $contentType[0]);
switch ($bodyFormat[0]) { switch ($bodyFormat[0]) {

Loading…
Cancel
Save