Skip to content

Getting blank result on routing to new Response when changing location. #664

Closed
rapzo opened this Issue Oct 12, 2012 · 4 comments

3 participants

@rapzo
Union of RAD member
rapzo commented Oct 12, 2012

After latest changes on the Request & Response classes all situations where the \lithium\action\Response with location property hard-coded is returned result in a blank body, although the params and the path are translated as expected.

Example:

Router::connect('/route', array(), function($request) {
    return new \lithium\action\Response(array(
        'location' => array(
            'controller' => 'pages',
            'action' => 'view'
        )
    ));
});

With everything out-of-the-box prints a blank result. Before the changes worked like a charm.
Tried to trace it back but it doesn't generate any error.
Can't say if it is a bug or a misuse of the response object.
Let me know what you think.

Cheers.

@nateabele
Union of RAD member

Okay, it's possible that it's no longer setting the status code to 302, which means the browser's not gonna do anything with it.

Can you give us a unit test, or at least a dump of the HTTP response that your Response object generates?

@rapzo
Union of RAD member
rapzo commented Oct 13, 2012

Tried to write unit tests but couldn't get nowhere... All tests seem ok... But it just doesn't work...
Here are two dumps, if it help... The first is before the commits (with the type set) and after:
http://pastium.org/view/97fb0153c0baadc66d03b25aabd0374a
http://pastium.org/view/97fb0153c0baadc66d03b25aabd039ac

It was tested with a new app and only added a route:

Router::connect('/', 'Pages::view');

Router::connect('/blast', array(), function($request) {
    return new \lithium\action\Response(array(
        'location' => array(
            'controller' => 'Pages',
            'action' => 'view'
        )
    ));
});

Hope it helps. Say something if you need anything else.

@inoui
inoui commented Oct 18, 2012

Hi Guys, got the same problem here after last changes.

@nateabele
Union of RAD member

Yeah, so the issue is that for whatever reason, setting a 'location' no longer automatically sets the status code to 302. I'm working on a fix, but for now, just add 'status' => 302 to the array to fix it temporarily.

@nateabele nateabele closed this in 96bb832 Oct 19, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.