[HttpFoundation] Rename Request::getContentType to getContentTypeFormat#45034
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
efea1a1 to
f4409c8
Compare
wouterj
left a comment
There was a problem hiding this comment.
Looks good from my point of view 👍
59db8a5 to
c2c3b20
Compare
|
@wouterj Thank you for your kind feedback. Sorry for all the updates, I completely forgot to add tests and the necessary deprecation infos. Should be ready now. The CI failure is very mysterious to me. |
|
No problem! For a first contribution, this is in perfect shape (especially considering changes like this need BC and deprecations and stuff). |
|
I made an attempt to make appveyor happy (I think i understood the subsequent deprecation emitted in security/http). |
f949c8c to
75daa15
Compare
| $request = new Request(); | ||
| $contentType = $request->getContentTypeFormat(); | ||
|
|
||
| $this->assertNull($contentType); |
There was a problem hiding this comment.
Would be great to add more tests covering cases where that method returns a non-null value. Otherwise, we don't really have tests for the feature.
There was a problem hiding this comment.
Thank you for the suggestion. I added tests to cover the mime types application/json and text/html
|
Friendly ping @MarkPedron, up to finish this PR? See pending comments + rebase needed. |
6b0c8e2 to
c092b30
Compare
|
@nicolas-grekas Thanks for the reminder. I added non-null tests as suggested, accepted the suggestion expanding the comment, and rebased. If there is anything else to be done, please let me know. I am hesitating to expand the comments further, as to me the meaning of getContentTypeFormat seems quite clear, and confusion arises from the methods setRequestFormat/getRequestFormat, which (to my understanding) refer to the negotiated format of the Response. |
c092b30 to
ccc77fc
Compare
Resolves issue symfony#39750. The method getContentType was confusing. This method does not return a mime type, but a mapped type name derived from the mime type in the CONTENT_TYPE header.
ccc77fc to
f545ed4
Compare
|
Thank you @MarkPedron. |
…mNaN) This PR was merged into the 6.4 branch. Discussion ---------- [Security] Remove BC layer for HttpFoundation < 6.2 | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | n/a In #45034, a condition was added to support `symfony/http-foundation < 6.2` or use the new `Request::getContentTypeFormat()` method when it exists. I propose to update the minimum version of `symfony/http-foundation` required by `symfony/security-http: 6.4`. `symfony/security-http: 6.4` already requires `symfony/http-kernel: ^6.3|^7.0` [which require](https://github.com/symfony/symfony/blob/6.3/src/Symfony/Component/HttpKernel/composer.json) `symfony/http-foundation: ^6.2.7` The legacy method `Request::getContentType()` will be removed in 7.0 by #50826 Commits ------- 746c3fd Remove BC layer for HttpFoundation < 6.1
… behaviors (GromNaN) This PR was squashed before being merged into the 7.0 branch. Discussion ---------- [HttpFoundation] Remove deprecated classes, method and behaviors | Q | A | ------------- | --- | Branch? | 7.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | n/a Clean `symfony/http-foundation` from all its legacy. - Remove `RequestMatcher` and `ExpressionRequestMatcher`, deprecated since #47595 - Remove `Request::getContentType()`, deprecated since #45034 - Throw a `UnexpectedValueException` or `BadRequestException` when `ParameterBag::filter()` or `InputBag::filter()` reads an invalid value and the flag `FILTER_NULL_ON_FAILURE` is not set. new behavior announced since #48525 - Throw a `InvalidArgumentException` when calling `Request::create()` with a malformed URI, deprecated since #49376 Commits ------- 665a775 [HttpFoundation] Remove deprecated classes, method and behaviors
Uh oh!
There was an error while loading. Please reload this page.