-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
fix: Optimize the usage of option 'baseURI' for CURLRequest #9273
Conversation
@@ -208,10 +209,12 @@ public static function curlrequest(array $options = [], ?ResponseInterface $resp | |||
|
|||
$config ??= config(App::class); | |||
$response ??= new Response($config); | |||
$uri = new URI($options['baseURI'] ?? ($options['base_uri'] ?? null)); |
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.
parentheses should not needed:
$uri = new URI($options['baseURI'] ?? ($options['base_uri'] ?? null)); | |
$uri = new URI($options['baseURI'] ?? $options['base_uri'] ?? null); |
* | ||
* @var URI | ||
*/ | ||
protected $baseURI; |
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.
bc break.
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.
Excuse me, this is my first time to submit pull request. What's meaning 'bc break'? And what should I do next?
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.
backward compatibility break, remove protected property is not allowed on fix pr.
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.
Thanks! Maybe I should submit to next version.
*/ | ||
protected function prepareURL(string $url): string | ||
protected function prepareURL(string $url, URI $uri): string |
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.
bc break as well.
@warmbook The only thing that needs to be changed is one line: - $uri = new URI($options['base_uri'] ?? null);
+ $uri = new URI($options['baseURI'] ?? null); It was a bug - in this particular case, there is no need to worry about deprecating anything. Just add an entry to the changelog with a description that it has been fixed. |
#9265
Description
Use option 'baseURI' first in Config\Services->curlrequest.
Use the property 'uri' of OutgoingRequest as default baseURI instead of the property 'baseURI' of CURLRequest.
Remove the property 'baseURI' of CURLRequest.
Nolonger parse 'baseURI' in 'parseOptions' method.
If 'baseURI' exists in 'request' method's options, create a new URI instance with it. Otherwise, use the property 'uri' of OutgoingRequest.
Use the param '$uri' passed in rather than the property 'baseURI' of CURLRequest in 'prepareURL' method.
Checklist: