Unchase.OpenAPI.Connectedservice
Unchase.OpenAPI.Connectedservice copied to clipboard
The generator returns an error if the endpoint has more than one valid status
if (status_ == 201)
{
var objectResponse_ = await ReadObjectResponseAsync<ProductsCreateResponse>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
//the line below is invalid
throw new ApiException<ProductsCreateResponse>("Create products correctly", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
}
else
if (status_ == 200)
{
var objectResponse_ = await ReadObjectResponseAsync<ProductsNotCreateResponse>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
return objectResponse_.Object;
}