We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Using NSwag.MSBuild 11.17.0
Code generation command: <Exec Command="$(NSwagExe) swagger2csclient /input:$(ProjectDir)\XXX.swagger.json /output:$(ProjectDir)\XXX.generated.cs /Namespace:XXX /ClientBaseClass:XXX /UseHttpRequestMessageCreationMethod:true /ConfigurationClass:XXX /UseHttpClientCreationMethod:true /GenerateOptionalParameters:true /ClassStyle:Poco" />
<Exec Command="$(NSwagExe) swagger2csclient /input:$(ProjectDir)\XXX.swagger.json /output:$(ProjectDir)\XXX.generated.cs /Namespace:XXX /ClientBaseClass:XXX /UseHttpRequestMessageCreationMethod:true /ConfigurationClass:XXX /UseHttpClientCreationMethod:true /GenerateOptionalParameters:true /ClassStyle:Poco" />
The C# generated code for a 202 response always throws an exception. Is this by design? 2xx codes are supposed to be non error.
Generated code looks like:
if (status_ == "202") { var responseData_ = await response_.Content.ReadAsStringAsync().ConfigureAwait(false); var result_ = default(xxx); try { result_ = Newtonsoft.Json.JsonConvert.DeserializeObject<xxx>(responseData_, _settings.Value); } catch (System.Exception exception_) { throw new SwaggerException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_); } throw new SwaggerException<xxx>("A server side error occurred.", (int)response_.StatusCode, responseData_, headers_, result_, null); // <-- ALWAYS THROWING EXCEPTION }
The text was updated successfully, but these errors were encountered:
Hello, I think this is a duplicate of #1259 : NSwag needs to understand that 202, 204... are success as well.
Sorry, something went wrong.
No branches or pull requests
Using NSwag.MSBuild 11.17.0
Code generation command:
<Exec Command="$(NSwagExe) swagger2csclient /input:$(ProjectDir)\XXX.swagger.json /output:$(ProjectDir)\XXX.generated.cs /Namespace:XXX /ClientBaseClass:XXX /UseHttpRequestMessageCreationMethod:true /ConfigurationClass:XXX /UseHttpClientCreationMethod:true /GenerateOptionalParameters:true /ClassStyle:Poco" />
The C# generated code for a 202 response always throws an exception. Is this by design? 2xx codes are supposed to be non error.
Generated code looks like:
The text was updated successfully, but these errors were encountered: