Skip to content

Allow curl to follow redirects #140

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

Merged

Conversation

cristiangrama
Copy link
Contributor

Description

Some WooCommerce stores return a redirect for api calls where the query string with the credentials (consumer_key and consumer_secret) is included in the url.

For example https://my-store.com?consumer_key=x&consumer_secret=y will return a redirect to https://my-store.com/?consumer_key=x&consumer_secret=y. Since the curl object is not setting the curl opt CURL_FOLLOWLOCATION it will just return the html response and will also trigger a syntax error due to the failure to decode the JSON.

What this PR solves

If the WooCommerce client is configured to follow redirect than any 301 will just work without needing to adjust the URL. I would think that this should be a default option but I guess it's a good idea to leave it optional as well.

@claudiosanches claudiosanches merged commit 97844af into woocommerce:master Sep 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants