Skip to content

[Golang][client] Allow access to APIClient.cfg.HTTPClient & APIClient.cfg.BasePath #1321

@grokify

Description

@grokify
Description

There are scenarios where using the raw *HTTP.Client is desirable. This includes:

  1. Scenarios where API definition is not currently supported by OpenAPI Generator and a fallback to native *HTTP.Client with BasePath is necessary. Examples include:
  • requests with multiple multipart/form-data files. Today only one file is supported in APIClient.prepareRequest
  • multipart/mixed responses. This is not handled in client.go's detectContentType
  1. Scenarios where a third-party library uses a *HTTP.Client

Providing access to the *HTTP.Client and Configuration.BasePath is useful in these scenarios.

Of course, we should support the API use cases, but sometimes more invasive changes take longer to implement.

openapi-generator version

master

OpenAPI declaration file content or url
          -
            name: "attachment"
            in: "formData"
            description: "File to upload"
            required: false
            type: "array"
            items:
              type: "file"
Command line used for generation

n/a

Steps to reproduce

n/a

Related issues/PRs
Suggest a fix/enhancement

Either:

  1. Provide an accessor to APIClient.cfg
  2. Provide accessors to APIClient.cfg.HTTPClient and APIClient.cfg.BasePath

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions