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

Comments

Projects
None yet
2 participants
@domsew

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)

@RSuter

This comment has been minimized.

Show comment
Hide comment
@RSuter

RSuter Oct 4, 2018

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.

Owner

RSuter commented Oct 4, 2018

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.

@RSuter RSuter closed this in f7aef82 Oct 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment