Skip to content

Conversation

@warmbook
Copy link

@warmbook warmbook commented Nov 13, 2024

#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:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide


$config ??= config(App::class);
$response ??= new Response($config);
$uri = new URI($options['baseURI'] ?? ($options['base_uri'] ?? null));
Copy link
Member

Choose a reason for hiding this comment

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

parentheses should not needed:

Suggested change
$uri = new URI($options['baseURI'] ?? ($options['base_uri'] ?? null));
$uri = new URI($options['baseURI'] ?? $options['base_uri'] ?? null);

*
* @var URI
*/
protected $baseURI;
Copy link
Member

Choose a reason for hiding this comment

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

bc break.

Copy link
Author

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?

Copy link
Member

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.

Copy link
Author

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.

* a full URL by prepending $uri to it.
*/
protected function prepareURL(string $url): string
protected function prepareURL(string $url, URI $uri): string
Copy link
Member

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 warmbook closed this Nov 13, 2024
@michalsn
Copy link
Member

@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.

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.

3 participants