Remove unnecessary json_encode() on post data when using json content-type

This commit is contained in:
Zach Borboa
2016-09-30 21:44:16 -07:00
parent 459231fae7
commit d17da3e5ee
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -9,7 +9,8 @@ echo 'hello, world';
EOF;
$curl = new Curl();
$curl->post('https://api.github.com/gists', json_encode(array(
$curl->setHeader('Content-Type', 'application/json');
$curl->post('https://api.github.com/gists', array(
'description' => 'PHP-Curl-Class test.',
'public' => 'true',
'files' => array(
@@ -17,6 +18,6 @@ $curl->post('https://api.github.com/gists', json_encode(array(
'content' => $content,
),
),
)));
));
echo 'Gist created at ' . $curl->response->html_url . "\n";