OpenAPITools / OpenAPITools/openapi-generator

[REQ][php] Allow consumers to configure http version

Open
#9,119 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

There is no way to turn on http/2 in php client without messing with templates atm

Guzzle supports it like this:

use GuzzleHttp\Client;

$client = new Client();
$client->get('https://google.com/', [
    'version' => 2.0,
    'debug' => true,
]);

Describe the solution you'd like

It looks like a good idea to extend Configuration.php with httpVersion/getHttpVersion/setHttpVersion.
If it's expicitly set by the client consumer, than we can use it in createHttpClientOptions and call it a day

Describe alternatives you've considered

We can also just set version 2.0 by default, but this will probably lead to lots of problems since http/2 support in Guzzle is far from being ideal

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Configuration.mustache to inspect the proposed httpVersion, getHttpVersion, and setHttpVersion additions, then trace createHttpClientOptions in api.mustache. Done means a generated PHP client lets consumers configure the HTTP version and passes that value into the Guzzle request options.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.