Skip to content

Commit

Permalink
Merge pull request #41 from ConvertKit/v4-api-tests-broadcasts
Browse files Browse the repository at this point in the history
v4 API: Tests: Broadcasts
  • Loading branch information
n7studios authored Apr 18, 2024
2 parents 62f12d8 + 7f877c9 commit c33a5a9
Show file tree
Hide file tree
Showing 4 changed files with 252 additions and 54 deletions.
1 change: 1 addition & 0 deletions .env.dist.testing
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ TEST_TABLE_PREFIX=wp_
TEST_SITE_WP_URL=http://127.0.0.1
TEST_SITE_WP_DOMAIN=127.0.0.1
TEST_SITE_ADMIN_EMAIL=wordpress@convertkit.local
CONVERTKIT_API_BROADCAST_ID="8697158"
CONVERTKIT_API_FORM_ID="2765139"
CONVERTKIT_API_LEGACY_FORM_ID="470099"
CONVERTKIT_API_LANDING_PAGE_ID="2765196"
Expand Down
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ CONVERTKIT_OAUTH_ACCESS_TOKEN_NO_DATA=
CONVERTKIT_OAUTH_REFRESH_TOKEN_NO_DATA=
CONVERTKIT_OAUTH_CLIENT_ID=
CONVERTKIT_OAUTH_REDIRECT_URI=
CONVERTKIT_API_BROADCAST_ID="8697158"
CONVERTKIT_API_FORM_ID="2765139"
CONVERTKIT_API_LEGACY_FORM_ID="470099"
CONVERTKIT_API_LANDING_PAGE_ID="2765196"
Expand Down
6 changes: 5 additions & 1 deletion src/class-convertkit-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -1018,8 +1018,12 @@ public function request( $endpoint, $method = 'get', $params = array(), $retry_i
// Send request.
switch ( strtolower( $method ) ) {
case 'get':
// We deliberate don't use add_query_arg(), as this converts double equal signs (typically
// provided by `start_cursor` and `end_cursor`) to a single equal sign, therefore breaking
// pagination. http_build_query() will encode equals signs instead, preserving them
// and ensuring paginated requests work correctly.
$result = wp_remote_get(
add_query_arg( $params, $this->get_api_url( $endpoint ) ),
$this->get_api_url( $endpoint ) . '?' . http_build_query( $params ),
array(
'headers' => $this->get_request_headers(),
'timeout' => $this->get_timeout(),
Expand Down
Loading

0 comments on commit c33a5a9

Please sign in to comment.