Skip to content

[BUG][C-Sharp] HTTP subpath is ignored in the configured BaseAddress of the HttpClient #19451

@Dragemil

Description

@Dragemil

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Let's assume we've configured the BaseAddress of the HttpClient used in the generated C# client from the OpenAPI description like so:

client.BaseAddress = new Uri("http://localhost/subpath/");

Then, using the generated client, the /subpath/ part of the BaseAddress is completely ignored when sending HTTP requests.

openapi-generator version

7.7.0

OpenAPI declaration file content or url

https://github.com/ory/kratos/blob/master/.schema/openapi.json

Generation Details

openapi-generator-cli generate --config <...>
https://github.com/leancodepl/dotnet-kratos-client/blob/master/generate.sh

Steps to reproduce
  1. Generate the C# OpenAPI client
  2. Configure HttpClient providing BaseAddress with a subpath
  3. Attempt to send a request using generated client
Related issues/PRs

Somehow related issue, where generated client ignored provided HTTP scheme: #14682

Suggest a fix

Instead of building the base address ourselves, maybe we should use the one already configured in the HttpClient?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions