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 before_redirect hook to alter redirects #205

Merged
merged 1 commit into from
Apr 19, 2016
Merged

Conversation

rmccue
Copy link
Collaborator

@rmccue rmccue commented Apr 18, 2016

This allows implementing things like browser-compatible redirect handling:

$hooks->register( 'requests-requests.before_redirect', function ( $location, $headers, $data, &$options, $original ) {
    // Browser compat
    if ( $original->status_code === 301 || $original->status_code === 302 ) {
        $options['type'] = Requests::GET;
    }
});

Fixes #201, see #178.

@rmccue rmccue added this to the 1.7 milestone Apr 18, 2016
@rmccue rmccue merged commit 75e2e98 into master Apr 19, 2016
@rmccue rmccue deleted the redirect-hook branch April 19, 2016 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant