Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a warning when Cloudflare blocks REST API requests #8640

Merged
merged 14 commits into from
Aug 8, 2018
Merged
2 changes: 1 addition & 1 deletion packages/api-fetch/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function registerMiddleware( middleware ) {
}

function checkCloudflareError( error ) {
if ( error.indexOf( 'Cloudflare Ray ID' ) >= 0 ) {
if ( error.indexOf && error.indexOf( 'Cloudflare Ray ID' ) >= 0 ) {
Copy link
Member

@gziolo gziolo Aug 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe:

 typeof error === 'string'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

throw {
code: 'cloudflare_error',
};
Expand Down