Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[HttpClient] Enable using EventSourceHttpClient::connect() for both GET and POST#51558

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:6.4fromwivaku:patch-1
Sep 14, 2023

Conversation

@wivaku
Copy link
Contributor

@wivakuwivaku commentedSep 4, 2023
edited by nicolas-grekas
Loading

QA
Branch?6.4
Bug fix?yes
New feature?no
Deprecations?no
LicenseMIT

Fix so connect() can be used for SSE connections that require POST, e.g. GraphQL SSE subscriptions. This so we don't have to manually create the request() and include all of the options that are used for connect().

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 6.4 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@derrabus
Copy link
Member

This looks like a new feature to me, especially since we need to change a method signature. Also, please note that we usually don't merge changes that are not covered by tests.

@derrabusderrabus modified the milestones:6.3,6.4Sep 4, 2023
@derrabusderrabus changed the base branch from6.3 to6.4September 4, 2023 22:39
@carsonbotcarsonbot changed the titleenable using connect() for both GET and POST[HttpClient] enable using connect() for both GET and POSTSep 4, 2023
@wivaku
Copy link
ContributorAuthor

What you say makes sense. Technically it's indeed not a bug. At the same time, was not sure it really deserved being called a feature.
As the change maintains backwards compatibility (before: always GET, after: optional argument that defaults to GET) andconnect() is basically a wrapper torequest() where both GET and POST are allowed, I was not sure if a test is needed.
My knowledge of the internals of the code is not sufficient to add a test.
Can someone help?

@stof
Copy link
Member

stof commentedSep 5, 2023

@wivaku we still need tests to cover the new feature you are adding (which is here to prevent regressing on it which would break it).

and anything that is not a bug fix is treated as a new feature going into the next minor version.
Btw, adding support for POST requests is definitely a new feature.

@wivaku
Copy link
ContributorAuthor

What both of you say makes sense. Technically it's indeed not a bug. At the same time, was not sure it really deserved being called a feature. POST was already allowed (usingrequest) andconnect is basically a wrapper that sets the headers forrequest.

As the change maintains backwards compatibility (before: always GET, after: optional argument that defaults to GET) andconnect() is basically a wrapper torequest() where both GET and POST are allowed, I was not sure if a test is needed. Totally fine if you feel it does need a test.

My knowledge of the internals of the code is not sufficient to add one though.
Can someone help?

@stof
Copy link
Member

stof commentedSep 5, 2023

@wivakuAdd support for POST requests in `EventSourceHttpClient::connect()` is definitely describing a feature addition. And this is exactly what this PR does.
Btw, the changelog also needs to be updated.

And the rule is that anything that is not a bug fix goes into the next minor version. It is not about deserving being called a feature or no.

As the change maintains backwards compatibility (before: always GET, after: optional argument that defaults to GET) andconnect() is basically a wrapper torequest() where both GET and POST are allowed, I was not sure if a test is needed. Totally fine if you feel it does need a test.

The new test is not there to ensure this PR maintains backward compatibility (that's what the existing test ensure). It is there to ensure that *future PRs do not break the change you introduce in this one.
Without a test covering this feature, there is nothing preventing the support of POST requests to be broken by a future change (your own app would then become the CI reporting that this got broken, hopefully in your own CI if you have one or in production if it is not covered, but that would leave you with 1 month until the next patch release to get a fix being released...)

My knowledge of the internals of the code is not sufficient to add one though.

Look at the existing tests of the EventSourceHttpClient. The test for POST will be quite similar except that the mock will expect being called with a POST method.

@wivaku
Copy link
ContributorAuthor

Ok, attempted to add test. Similar to the GET test, but only checking the response, not the responseStream as this is already covered by the GET test.

All this, including Mockery tests are quite new to me, so apologies if I'm doing something wrong.

Because of my lack of experience the way I read the Mockery test is confusing to me: in the test I specify that the response will be for the method and then I test if the response I get is indeed that response.

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks for the PR. Please add a line to the changelog of the component about this.

@nicolas-grekasnicolas-grekas changed the title[HttpClient] enable using connect() for both GET and POST[HttpClient] Enable using EventSourceHttpClient::connect() for both GET and POSTSep 12, 2023
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I fixed my review comments.

@nicolas-grekas
Copy link
Member

Thank you@wivaku.

@nicolas-grekasnicolas-grekas merged commit7c833ee intosymfony:6.4Sep 14, 2023
This was referencedOct 21, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

6.4

Development

Successfully merging this pull request may close these issues.

5 participants

@wivaku@carsonbot@derrabus@stof@nicolas-grekas

[8]ページ先頭

©2009-2025 Movatter.jp