Changeset 7750
- Timestamp:
- 10/19/2018 08:06:43 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/utilities/class-meetup-client.php
r7638 r7750 84 84 $this->error->add( 85 85 'unexpected_response_data', 86 'The API response did not provide the expected data format.' 86 'The API response did not provide the expected data format.', 87 $response 87 88 ); 88 89 break; … … 169 170 * See https://www.meetup.com/meetup_api/docs/#errors. 170 171 * 172 * `200` (ok) is not in the list, because it needs to be handled conditionally. See below. 173 * 171 174 * `400` (bad request) is not in the list, even though it seems like it _should_ indicate an unrecoverable 172 175 * error. In practice we've observed that it's common for a seemingly valid request to be rejected with … … 174 177 */ 175 178 $breaking_codes = array( 176 200, // Ok.177 179 401, // Unauthorized (invalid key). 178 180 429, // Too many requests (rate-limited). … … 190 192 191 193 $this->maybe_throttle( wp_remote_retrieve_headers( $response ) ); 194 195 /* 196 * Sometimes their API inexplicably returns a success code with an empty body, but will return a valid 197 * response if the exact request is retried. 198 */ 199 if ( 200 === $response_code && ! empty( wp_remote_retrieve_body( $response ) ) ) { 200 break; 201 } 192 202 193 203 if ( in_array( $response_code, $breaking_codes, true ) ) {
Note: See TracChangeset
for help on using the changeset viewer.