Skip to content

Commit

Permalink
改变了http 中 json 方法的接口, 从而支持 添加 添加 query参数 (#539)
Browse files Browse the repository at this point in the history
  • Loading branch information
shoaly authored and overtrue committed Dec 9, 2016
1 parent 15aea1f commit 321a511
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Core/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,17 @@ public function post($url, $options = [])
*
* @param string $url
* @param string|array $options
* @param array $queries
* @param int $encodeOption
*
* @return ResponseInterface
*
* @throws HttpException
*/
public function json($url, $options = [], $encodeOption = JSON_UNESCAPED_UNICODE)
public function json($url, $options = [], $encodeOption = JSON_UNESCAPED_UNICODE, $queries = [])
{
is_array($options) && $options = json_encode($options, $encodeOption);

return $this->request($url, 'POST', ['body' => $options, 'headers' => ['content-type' => 'application/json']]);
return $this->request($url, 'POST', ['query' => $queries,'body' => $options, 'headers' => ['content-type' => 'application/json']]);
}

/**
Expand Down

0 comments on commit 321a511

Please sign in to comment.