Skip to content

Invalid request headers generated for csharp client #4211

Closed

Description

Command used:

dotnet kiota generate --openapi ./content-type-openapi.json -o Generated --language CSharp

dotnet kiota --version
1.11.1+86b3a623dc3fb6b55fed6a49519ec837f0fbc02c

With the following openapi spec:

{
    "openapi": "3.0.2",
    "info": {
        "title": "ContentType",
        "version": "1.0.0"
    },
    "paths": {
        "/test": {
            "post": {
                "requestBody": {
                  "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/test"
                            }
                        },
                        "application/json; profile=\"CamelCase\"": {
                            "schema": {
                                "$ref": "#/components/schemas/test"
                            }
                        },
                        "application/json; profile=\"PascalCase\"": {
                            "schema": {
                                "$ref": "#/components/schemas/test"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "response",
                        "content": {
                            "application/json": {
                                "schema": {
                                "$ref": "#/components/schemas/test"
                                }
                            },
                            "application/json; profile=\"CamelCase\"": {
                                "schema": {
                                "$ref": "#/components/schemas/test"
                                }
                            },
                            "application/json; profile=\"PascalCase\"": {
                                "schema": {
                                "$ref": "#/components/schemas/test"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
          "test":  {
            "type": "object",
            "properties": {
              "prop1": {
                "type": "integer",
                "format": "int32"
              }
            }
          }
        }
    }
}

The following line is generated:

requestInfo.Headers.TryAdd("Accept", "application/json, application/json;profile="CamelCase", application/json;profile="PascalCase"");

where it should be:

requestInfo.Headers.TryAdd("Accept", "application/json, application/json;profile=\"CamelCase\", application/json;profile=\"PascalCase\"");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

CsharpPull requests that update .net codeWIPhelp wantedIssue caused by core project dependency modules or librarytype:bugA broken experience

Type

No type

Projects

  • Status

    Done ✔️

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions