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

CSharp Client does not support versioned API #1649

Closed
domsew opened this issue Oct 4, 2018 · 1 comment
Closed

CSharp Client does not support versioned API #1649

domsew opened this issue Oct 4, 2018 · 1 comment

Comments

@domsew
Copy link

domsew commented Oct 4, 2018

Generated CSharp Client adds Accept Header to the request (HttpRequestMessage).

request_.Headers.Accept
    .Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json;v=1.0"));

Object

new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json;v=1.0")

Throws exception:

FormatException: The format of value 'application/json;v=1.0' is invalid.

Possible solutions:

  • Use method:
MediaTypeWithQualityHeaderValue.Parse("application/json;v=1.0")
  • Or
client_.DefaultRequestHeaders
    .TryAddWithoutValidation("Accept", new []{ "application/json", "v=1.0" });

EDIT:
I noticed this behavior with Console App (.NET Core)

@RicoSuter
Copy link
Owner

Let's use MediaTypeWithQualityHeaderValue.Parse("application/json;v=1.0") as it is easier to just render this instead of checking the actual string etc.

@RicoSuter RicoSuter mentioned this issue Nov 15, 2018
5 tasks
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

2 participants