Skip to content

Commit

Permalink
Merge pull request #52 from hhxsv5/master
Browse files Browse the repository at this point in the history
Fix Content-Type for GET/DELETE method
  • Loading branch information
hhxsv5 authored May 9, 2019
2 parents c2fbd46 + 5bb1f90 commit c9ab87e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Http/SwooleHttp.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function request(Request $request, $timeout = 30)
'ssl_verify_peer' => empty($this->config['skipVerifyTls']),
];
$client = static::getClient($config);
$options['headers'] = $request->getHeaders() + ['Content-Type' => ContentType::JSON];
$options['headers'] = $request->getHeaders();

$method = $request->getMethod();
$requestUri = $request->getRequestUri();
Expand All @@ -64,6 +64,7 @@ public function request(Request $request, $timeout = 30)
case Request::METHOD_PUT:
case Request::METHOD_POST:
$data = $request->getBodyParams();
$options['headers']['Content-Type'] = ContentType::JSON;
/**@var \Swlib\Saber\Response $saberResponse */
$saberResponse = $client->{strtolower($method)}($requestUri, $data, $options);
break;
Expand All @@ -87,4 +88,4 @@ public function request(Request $request, $timeout = 30)
throw $exception;
}
}
}
}

0 comments on commit c9ab87e

Please sign in to comment.