Skip to content
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

Allow to pass an existing request object in constructor #442

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ofabel
Copy link

@ofabel ofabel commented Jul 14, 2024

The current implementation always creates the HTTP request from the superglobals:

public function __construct()
{
    if (null === $this->request) {
        $this->request = HttpRequest::createFromGlobals();
    }
}

But this is not always possible (e.g. when using RoadRunner). It's also an issue in combination with other frameworks (see #440).

With this pull request, users can pass their own Symfony HTTP request object in the constructor - if necessary.

Of course one could also extend the Request class and do the same. But this would also require extending the Server class.

Copy link

codecov bot commented Jul 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.60%. Comparing base (a466a9b) to head (41acd14).

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #442   +/-   ##
=========================================
  Coverage     99.60%   99.60%           
  Complexity      362      362           
=========================================
  Files            20       20           
  Lines          1007     1008    +1     
=========================================
+ Hits           1003     1004    +1     
  Misses            4        4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

1 participant