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 possibility to bypass requests to another request method without a redirect #16

Closed
hollodotme opened this issue Oct 28, 2016 · 0 comments
Assignees
Milestone

Comments

@hollodotme
Copy link
Member

hollodotme commented Oct 28, 2016

When state changing requests hit the server via GET request method, we need to handle them (and change state) on the read side. This breaks the approach of separating read / write by their meanings.

In order to handle such a state changing GET request correctly, add configurable request bypasses to internally reroute the read request to a write request, so that a write request handler is responsible for handling the request and the business logic is kept separated.

<?php declare(strict_types=1);

namespace YourVendor\YourProject;

class IceHawkConfig implements ConfiguresIceHawk
{
    public function getRequestBypasses()
    {
        return [
            new RequestBypass( 
                new Literal('/get/that/writes'), 
                '/write/that/handles', 
                HttpMethod::POST 
            ),
        ];
    }
}

The bypasser will - if necessary - create a new request info object that is matched against the normal routing definitions.

@hollodotme hollodotme added this to the v2.1.0 milestone Oct 28, 2016
@hollodotme hollodotme self-assigned this Oct 28, 2016
@hollodotme hollodotme assigned Hansel23 and unassigned hollodotme Nov 12, 2016
@hollodotme hollodotme changed the title Add a proxy route type Add a possibility to bypass requests to another request method without a redirect Dec 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants