{"action":"reopened","issue":{"url":"https://api.github.com/repos/linslin/Yii2-Curl/issues/68","repository_url":"https://api.github.com/repos/linslin/Yii2-Curl","labels_url":"https://api.github.com/repos/linslin/Yii2-Curl/issues/68/labels{/name}","comments_url":"https://api.github.com/repos/linslin/Yii2-Curl/issues/68/comments","events_url":"https://api.github.com/repos/linslin/Yii2-Curl/issues/68/events","html_url":"https://github.com/linslin/Yii2-Curl/issues/68","id":262409199,"number":68,"title":"Post json string","user":{"login":"bologer","id":9879933,"avatar_url":"https://avatars1.githubusercontent.com/u/9879933?v=4","gravatar_id":"","url":"https://api.github.com/users/bologer","html_url":"https://github.com/bologer","followers_url":"https://api.github.com/users/bologer/followers","following_url":"https://api.github.com/users/bologer/following{/other_user}","gists_url":"https://api.github.com/users/bologer/gists{/gist_id}","starred_url":"https://api.github.com/users/bologer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bologer/subscriptions","organizations_url":"https://api.github.com/users/bologer/orgs","repos_url":"https://api.github.com/users/bologer/repos","events_url":"https://api.github.com/users/bologer/events{/privacy}","received_events_url":"https://api.github.com/users/bologer/received_events","type":"User","site_admin":false},"labels":[{"id":146740114,"url":"https://api.github.com/repos/linslin/Yii2-Curl/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":{"login":"linslin","id":6159031,"avatar_url":"https://avatars0.githubusercontent.com/u/6159031?v=4","gravatar_id":"","url":"https://api.github.com/users/linslin","html_url":"https://github.com/linslin","followers_url":"https://api.github.com/users/linslin/followers","following_url":"https://api.github.com/users/linslin/following{/other_user}","gists_url":"https://api.github.com/users/linslin/gists{/gist_id}","starred_url":"https://api.github.com/users/linslin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linslin/subscriptions","organizations_url":"https://api.github.com/users/linslin/orgs","repos_url":"https://api.github.com/users/linslin/repos","events_url":"https://api.github.com/users/linslin/events{/privacy}","received_events_url":"https://api.github.com/users/linslin/received_events","type":"User","site_admin":false},"assignees":[{"login":"linslin","id":6159031,"avatar_url":"https://avatars0.githubusercontent.com/u/6159031?v=4","gravatar_id":"","url":"https://api.github.com/users/linslin","html_url":"https://github.com/linslin","followers_url":"https://api.github.com/users/linslin/followers","following_url":"https://api.github.com/users/linslin/following{/other_user}","gists_url":"https://api.github.com/users/linslin/gists{/gist_id}","starred_url":"https://api.github.com/users/linslin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linslin/subscriptions","organizations_url":"https://api.github.com/users/linslin/orgs","repos_url":"https://api.github.com/users/linslin/repos","events_url":"https://api.github.com/users/linslin/events{/privacy}","received_events_url":"https://api.github.com/users/linslin/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2017-10-03T12:31:13Z","updated_at":"2017-10-04T08:10:52Z","closed_at":null,"author_association":"NONE","body":"Sometimes it is useful to post simple json string: \r\n\r\n```\r\ncurl http://youdomain.com/api --data '[\"whatever here\", \"again\"]'\r\n```\r\nIn this case this would not work: \r\n```php\r\n/**\r\n * Set get params\r\n *\r\n * @param array $params\r\n * @return $this\r\n */\r\npublic function setPostParams($params)\r\n{\r\n    if (is_array($params)) {\r\n        $this->setOption(\r\n            CURLOPT_POSTFIELDS,\r\n            http_build_query($params)\r\n        );\r\n    }\r\n    return $this;\r\n}\r\n```\r\n\r\nit is required to change it to this to make method accept plain strings as well:\r\n```php\r\n/**\r\n * Set get params as array or as plain string, such as JSON.\r\n *\r\n * @param array|string $params\r\n * @return $this\r\n */\r\npublic function setPostParams($params)\r\n{\r\n    $this->setOption(\r\n        CURLOPT_POSTFIELDS,\r\n        is_array($params) ? http_build_query($params) : $params\r\n    );\r\n    return $this;\r\n}\r\n```"}}
{"actor":{"display_login":"linslin"}}