This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
Deprecate Http subnamespace #70
Merged
weierophinney
merged 4 commits into
zendframework:develop
from
weierophinney:feature/decorator-deprecation
Sep 30, 2016
Merged
Deprecate Http subnamespace #70
weierophinney
merged 4 commits into
zendframework:develop
from
weierophinney:feature/decorator-deprecation
Sep 30, 2016
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When invoked, injects attributes into the request for each of: - originalUri - originalRequest - originalResponse and passes the new request on to `$next()`. Updated Http\Request to: - inject the `originalRequest` attribute into the stored "PSR" request, ensuring that access to that attribute will return the original request. Updated FinalHandler: - to check for the `originalRequest` attribute, instead of testing for `Http\Request` and calling `getOriginalRequest()`. - to no longer cast the response to `Http\Response` when writing content to it; it now writes to the response body directly. - to cast responses to `Http\Response` prior to triggering the `onerror` handler; this is done to ensure types remain the same, in case developers typehint on the Stratigility message types in their handlers. Finally, updated the request/response class-level docblocks to refer to the `OriginalMessages` middleware as a means for injecting the attributes containing the original artifacts.
…vocations This patch updates the codebase to trigger deprecation notices when invoking the various custom methods in the request and response decorators. The notices detail why they are triggered, how to avoid them, and link to relevant migration documentation. Some tests needed updates. In particular, any tests that might produce Stratigility HTTP message artifacts were updated to expect the deprecation notices and skip over them if discovered. In a few cases, methods from the messages were exercised by tests, and these were updated to no longer do so. A few expectations were also made on the Stratigility HTTP message types; these were updated to the looser PSR-7 message types.
The next in the 1.3/2.0 series of deprecations and improvements. Pinging @zendframework/community-review-team , @michaelmoussa , and @xtreamwayz for review. |
Merged
akrabat
approved these changes
Sep 30, 2016
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
geerteltink
approved these changes
Sep 30, 2016
weierophinney
added a commit
that referenced
this pull request
Sep 30, 2016
weierophinney
added a commit
that referenced
this pull request
Sep 30, 2016
weierophinney
added a commit
that referenced
this pull request
Sep 30, 2016
Forward port #70 to dev-2.0.0 Conflicts: doc/book/migration/to-v2.md src/FinalHandler.php test/FinalHandlerTest.php test/MiddlewarePipeTest.php
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Per the RFC on removing the request and response decorators, this patch deprecates them for the upcoming 1.3 release.
The following changes were made:
Deprecated
Zend\Stratigility\Http\Request
originalRequest
, allowing retrieval using standard PSR-7 methods.getCurrentRequest()
andgetOriginalRequest()
now emit deprecation notices.Zend\Stratigility\Http\ResponseInterface
write()
,end()
,isComplete()
, andgetOriginalResponse()
now emit deprecation notices.Zend\Stratigility\Http\Response
Changed
Zend\Stratigility\FinalHandler
originalRequest
attribute instead.write()
method).Added
Zend\Stratigility\Middleware\OriginalMessages
is middleware that will inject the request instance passed to deeper layers with three attributes:originalRequest
, representing the request provided to itoriginalResponse
, representing the response provided to itoriginalUri
, representing the URI composed by the request provided to itWe now recommend that if you need any of these artifacts, you pipe this middleware as the first layer of your application.