Repository navigation
Force "object"-form when posting json - #40
Conversation
Force "object"-form when posting json
|
Good catch! Thanks! |
|
Actually I've noticed that other functions are now entirely broken. An example: This code generates the following error: Removing the JSON_FORCE_OBJECT parameter fixes the issue. I've worked around this issue by allowing the option to be toggled in HttpClient for now. It could of course also be that I'm doing something wrong (I'm fairly new to the library), please let me know if I did. PS: The GitHub API states that the 'body' parameter for an issue is optional, however it is required in the library: http://developer.github.com/v3/issues/#create-an-issue |
|
Hm maybe |
|
I also don't know the GitHub API that well (only started with it this week). Modifying line 171 of HttpClient.php to ... still fixes the issue for me. If this also still fixes the issue (i.e. it doesn't break it all over again) you originally reported, I think this may be a good solution. What's strange is that the rest of the library has worked mostly perfect up until now (even when I was posting new data on GitHub), it's just setting the labels that's broken. |
|
Yes this should be fine - my issue was when the whole body was an empty array/object. |
|
Done, it can be found here: http://github.com/KnpLabs/php-github-api/pull/48 |
When POSTing with no/empty content, we should send
{}instead of[], otherwise Github doesn't like it: