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

[PHP] Allows setting extra request options via config #11431

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jtreminio
Copy link
Contributor

@jtreminio jtreminio commented Jan 27, 2022

Allows setting extra headers in request. One use case is setting xdebug cookie for debugging locally.

$config = Configuration::getDefaultConfiguration();

$cookie = GuzzleHttp\Cookie\CookieJar::fromArray([
    'XDEBUG_SESSION' => 'xdebug',
], 'example.com');

$config->setOptions(['cookies' => $cookie]);

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (5.3.0), 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@jebentier @dkarlovi @mandrean @jfastnacht @ackintosh @ybelenko @renepardon

@tausa17
Copy link

tausa17 commented Feb 8, 2022

👍 This is something I'm just in the need of and I'm looking forward to it.

Copy link
Contributor

@ybelenko ybelenko left a comment

Choose a reason for hiding this comment

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

Basic unit test from me.

vendor/bin/phpunit tests/ConfigurationTest.php

PHPUnit 9.5.10 by Sebastian Bergmann and contributors.

.....                                                               5 / 5 (100%)

Time: 00:00.009, Memory: 6.00 MB

@dkarlovi
Copy link
Contributor

I'm 👎 on this change since it pushes us away from the actual solution we want, which is replaceable HTTP client. We're allowing to pass options to the HTTP client when we could pass the whole HTTP client which is preconfigured with those options, making the code here more complex. It's opposite of IoC, we're binding ourselves more tightly with the client by adding methods to configure it.

@jtreminio
Copy link
Contributor Author

@dkarlovi Unless I am mistake, the current setup does not permit a user from setting additional options, at all. Seems that allowing a user to do so while decoupling the generated SDK from whatever request library a user wants to use would be a much larger lift than a simple PR. Possibly a BC-break.

@wing328 wing328 added this to the 6.0.0 milestone Mar 10, 2022
@wing328 wing328 modified the milestones: 6.0.0, 6.0.1 May 26, 2022
@wing328 wing328 modified the milestones: 6.0.1, 6.1.0 Jul 5, 2022
@wing328 wing328 modified the milestones: 6.1.0, 6.1.1 Sep 11, 2022
@wing328 wing328 modified the milestones: 6.1.1, 6.2.1 Sep 24, 2022
@wing328 wing328 modified the milestones: 6.2.1, 6.3.0 Nov 1, 2022
@wing328 wing328 modified the milestones: 6.3.0, 6.3.1 Jan 20, 2023
@wing328 wing328 modified the milestones: 6.4.0, 6.5.0 Feb 19, 2023
@wing328 wing328 modified the milestones: 6.5.0, 6.6.0 Apr 1, 2023
@wing328 wing328 modified the milestones: 6.6.0, 7.0.0 May 11, 2023
@wing328 wing328 removed this from the 7.0.0 milestone Aug 25, 2023
@wing328 wing328 modified the milestones: 7.1.0, 7.0.1 Aug 25, 2023
@wing328 wing328 modified the milestones: 7.0.1, 7.1.0 Sep 20, 2023
@wing328 wing328 modified the milestones: 7.1.0, 7.2.0 Nov 13, 2023
@wing328 wing328 modified the milestones: 7.2.0, 7.3.0 Dec 22, 2023
@wing328 wing328 modified the milestones: 7.3.0, 7.4.0 Feb 8, 2024
@wing328 wing328 modified the milestones: 7.4.0, 7.5.0 Mar 11, 2024
@wing328 wing328 modified the milestones: 7.5.0, 7.6.0 Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants