Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

POST as JSON to the Twitter API #41

Merged

Conversation

weierophinney
Copy link
Member

All endpoints except for the various media upload endpoints can be sent as JSON; in fact, a few of the newer endpoints (media/metadata/create, direct_messages/events/new, and the direct_messages/welcome_messages/* endpoints) REQUIRE JSON payloads.

This patch updates the Twitter::performPost() method to json_encode() non-string $data, inject the $data as the request body, and to emit as Content-Type: application/json always.

This patch builds on #39 currently, and will be rebased once that patch is merged.

All endpoints except for the various media upload endpoints can be sent
as JSON; in fact, a few of the newer endpoints (`media/metadata/create`,
`direct_messages/events/new`, and the
`direct_messages/welcome_messages/*` endpoints) REQUIRE JSON payloads.

This patch updates the `Twitter::performPost()` method to
`json_encode()` non-string `$data`, inject the `$data` as the request
body, and to emit as `Content-Type: application/json` always.
@weierophinney weierophinney merged commit 4aa8d89 into zendframework:develop Aug 15, 2017
weierophinney added a commit that referenced this pull request Aug 15, 2017
weierophinney added a commit that referenced this pull request Aug 15, 2017
@weierophinney weierophinney deleted the feature/json-requests branch August 15, 2017 16:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant