zendframework / ZendService_Twitter

PHP OOP wrapper for the Twitter API
BSD 3-Clause "New" or "Revised" License
22 stars 23 forks source link

Send (most) payloads as form-urlencoded data #53

Closed weierophinney closed 6 years ago

weierophinney commented 6 years ago

As it turns out, while the expected content-type is still application/json (though in practice it doesn't matter what you send), the actual expected contents are supposed to be application/x-www-form-urlencoded regardless, except in a few cases (direct messages and media uploads).

This patch modifies the post() and performPost() methods slightly: the former checks to see if the provided $path is in a known whitelist for JSON payloads, and passes the result on to performPost(). That method then varies how the payload is created and injected into the request accordingly.

Fixes #48.