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

NSwag generated C# clients fail to set Content-Language header as it must be set on Content headers #4855

Open
kmgallahan opened this issue Apr 14, 2024 · 0 comments

Comments

@kmgallahan
Copy link

NSwag generated code from openapi specifications that indicate the Content-Language header is required for a POST request tries to do the following:

request_.Headers.TryAddWithoutValidation("Content-Language", ConvertToString(content_Language, System.Globalization.CultureInfo.InvariantCulture));

Which always fails because Content-Language is not a valid header there. Rather, it must be added to the content headers:

request_.Content = content_;
request_.Content.Headers.TryAddWithoutValidation("Content-Language", ConvertToString(content_Language, System.Globalization.CultureInfo.InvariantCulture));
@kmgallahan kmgallahan changed the title NSwag fails to set Content-Language header as it must be set on Content headers NSwag generated C# clients fail to set Content-Language header as it must be set on Content headers Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant