Thanks to visit codestin.com
Credit goes to github.com

Skip to content

"[HttpFoundation] fixed Request::create() method" breaks BrowserKit Client #7025

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

Closed
wants to merge 2 commits into from

Conversation

mevers47
Copy link
Contributor

@mevers47 mevers47 commented Feb 8, 2013

To functional test a REST service I call 'Symfony\Bundle\FrameworkBundle\Client::request' with the 'server' parameter. This parameter contains:

[HTTP_CONTENT-TYPE] => application/json
[HTTP_ACCEPT] => application/json

Since latest commit (this PR in particular: #6995) it fails my functional tests. I suspect the problem is somewhere near this piece of code (line: 320|329):

-    $defaults['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
+    $server['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';

This PR was submitted for the master branch but it was merged into the 2.2 branch instead (closes symfony#7021).

Commits
-------

c9c1ce6 [HttpKernel] exception listener, allow easier overloading of the default behavior

Discussion
----------

[HttpKernel] exception listener, allow easier overloading of the default behavior

Hi Fabien,

This commit you wrote about a month ago helped me to overload the 'logException' method:
symfony@1a6c9b3

Because the logger property was private I could not access it from the subclass. This PR changes both properties: controller and logger from private to public members. So they can be used from 'logException'.
@mevers47
Copy link
Contributor Author

mevers47 commented Feb 8, 2013

Should I make a PR?

Changing:

$server['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';

in an if statement, like this:

if (!isset($server['CONTENT_TYPE'])) {
    $server['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
}

@mevers47
Copy link
Contributor Author

mevers47 commented Feb 8, 2013

@fabien do I need to base my PR on the 'master' or '2.2' branch? It is now based on master, but I don't know what is more convenient for you. I close this PR if 2.2 is more convenient. Then I make a new PR based on 2.2 as github doesn't allow me to switch. Is that sensible?

@mevers47
Copy link
Contributor Author

Should I close this issue? I was under the impression I was working on master instead of 2.2.

Am I right to say that the 'test.client' service is not meant to use RESTfully? I perform REST requests using that service. When I call the request method the underlying protected 'filterRequest' does some implicit magic with the Content-Type.

To solve my problem I created a service named 'test.rest_client'. Implementing 'filterRequest' to allow REST. If you like, I can contribute it to Symfony as a new PR.

@fabpot
Copy link
Member

fabpot commented Feb 17, 2013

Closing in favor of #7098

@fabpot fabpot closed this Feb 17, 2013
fabpot added a commit that referenced this pull request Feb 17, 2013
This PR was merged into the 2.2 branch.

Commits
-------

738de9a [HttpKernel] added a unit for the previous commit (closes #7025)
d0e4b76 [HttpFoundation] fixed, overwritten CONTENT_TYPE

Discussion
----------

Fixed content type when passed as a server value

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #7025
| License       | MIT
| Doc PR        | n/a

---------------------------------------------------------------------------

by stof at 2013-02-17T14:51:35Z

:+1:
fabpot added a commit that referenced this pull request Feb 18, 2013
* 2.2: (22 commits)
  [Process] Fix regression introduced in #6620 / 880da01, fixes #7082
  [HttpKernel] added a unit for the previous commit (closes #7025)
  [HttpFoundation] fixed, overwritten CONTENT_TYPE
  [BrowserKit] fixed test added in the previous merge (refs #7059)
  [FrameworkBundle] tweaked reference dumper command (see #7093)
  Remove unnecessary comment and change test name
  [Config] tweaked dumper to indent multi-line info
  [HttpKernel] added some tests for previous merge
  Fix REMOTE_ADDR for cached subrequests
  [FrameworkBundle] CSRF should be on by default
  [WebProfilerBundle] removed dependency on FrameworkBundle (closes #6949)
  [HttpKernel] added error display suppression when using the ErrorHandler (if not, errors are displayed twice, refs #6254)
  [HttpFoundation] tweaked previous merge
  [HttpFoundation] Added getter for httpMethodParameterOverride state
  Create validators.lv.xlf
  [Process] Warn user with a useful message when tmpfile() failed
  [BrowserKit] added a test to make sure HTTP authentication is preserved when submitting a form
  Remove array type hint from GetResponseForControllerResultEvent::setControllerResult()
  bumped Symfony version to 2.2.0-DEV
  Revert "merged branch povilas/issue_6101 (PR #6708)"
  ...
ostrolucky pushed a commit to ostrolucky/symfony that referenced this pull request Mar 25, 2018
* 2.2: (22 commits)
  [Process] Fix regression introduced in symfony#6620 / 880da01, fixes symfony#7082
  [HttpKernel] added a unit for the previous commit (closes symfony#7025)
  [HttpFoundation] fixed, overwritten CONTENT_TYPE
  [BrowserKit] fixed test added in the previous merge (refs symfony#7059)
  [FrameworkBundle] tweaked reference dumper command (see symfony#7093)
  Remove unnecessary comment and change test name
  [Config] tweaked dumper to indent multi-line info
  [HttpKernel] added some tests for previous merge
  Fix REMOTE_ADDR for cached subrequests
  [FrameworkBundle] CSRF should be on by default
  [WebProfilerBundle] removed dependency on FrameworkBundle (closes symfony#6949)
  [HttpKernel] added error display suppression when using the ErrorHandler (if not, errors are displayed twice, refs symfony#6254)
  [HttpFoundation] tweaked previous merge
  [HttpFoundation] Added getter for httpMethodParameterOverride state
  Create validators.lv.xlf
  [Process] Warn user with a useful message when tmpfile() failed
  [BrowserKit] added a test to make sure HTTP authentication is preserved when submitting a form
  Remove array type hint from GetResponseForControllerResultEvent::setControllerResult()
  bumped Symfony version to 2.2.0-DEV
  Revert "merged branch povilas/issue_6101 (PR symfony#6708)"
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants