Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Implement RedirectResponse #59

Merged

Conversation

weierophinney
Copy link
Member

Besides the HTML and JSON responses introduced in #52 and the empty response implemented in #58, the other most common server-side response type is a redirect. This pull request implements a RedirectResponse, which accepts a URI in order to produce a 302 response with a Location header. As per the other response types, this custom response type allow specifying an alternate status code and headers to use at initialization.

Examples as documented:

// 302 redirect:
$response = new RedirectResponse('/user/login');

// 301 redirect:
$response = new RedirectResponse('/user/login', 301);

// using a URI instance (e.g., by altering the request URI instance)
$uri = $request->getUri();
$response = new RedirectResponse($uri->withPath('/login'));

@weierophinney weierophinney added this to the 1.1.0 milestone Jun 23, 2015
@weierophinney
Copy link
Member Author

ping @franzliedke — thought you might find this one interesting.

- Also, ensure that `InvalidArgumentException` is imported!
@weierophinney weierophinney mentioned this pull request Jun 23, 2015
@franzliedke
Copy link
Contributor

Cool. I like it. 👍

@weierophinney weierophinney merged commit d4867c6 into zendframework:develop Jun 24, 2015
weierophinney added a commit that referenced this pull request Jun 24, 2015
weierophinney added a commit that referenced this pull request Jun 24, 2015
@weierophinney weierophinney deleted the feature/redirect-response branch June 24, 2015 15:44
weierophinney added a commit that referenced this pull request Jun 24, 2015
Combined entries from #52, #58, #59, and #61 into one single narrative entry.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants