forked from loafle/openapi-generator-original
feat(csharp-netcore): Adding response headers to the ApiException (#7169)
This commit is contained in:
@@ -21,6 +21,12 @@ namespace {{packageName}}.Client
|
||||
/// <value>The error content (Http response body).</value>
|
||||
public object ErrorContent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the HTTP headers
|
||||
/// </summary>
|
||||
/// <value>HTTP headers</value>
|
||||
public Multimap<string, string> Headers { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ApiException"/> class.
|
||||
/// </summary>
|
||||
@@ -42,10 +48,12 @@ namespace {{packageName}}.Client
|
||||
/// <param name="errorCode">HTTP status code.</param>
|
||||
/// <param name="message">Error message.</param>
|
||||
/// <param name="errorContent">Error content.</param>
|
||||
public ApiException(int errorCode, string message, object errorContent = null) : base(message)
|
||||
/// <param name="headers">HTTP Headers.</param>
|
||||
public ApiException(int errorCode, string message, object errorContent = null, Multimap<string, string> headers = null) : base(message)
|
||||
{
|
||||
this.ErrorCode = errorCode;
|
||||
this.ErrorContent = errorContent;
|
||||
this.Headers = headers;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace {{packageName}}.Client
|
||||
{
|
||||
return new ApiException(status,
|
||||
string.Format("Error calling {0}: {1}", methodName, response.RawContent),
|
||||
response.RawContent);
|
||||
response.RawContent, response.Headers);
|
||||
}
|
||||
{{^netStandard}}if (status == 0)
|
||||
{
|
||||
|
||||
@@ -30,6 +30,12 @@ namespace Org.OpenAPITools.Client
|
||||
/// <value>The error content (Http response body).</value>
|
||||
public object ErrorContent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the HTTP headers
|
||||
/// </summary>
|
||||
/// <value>HTTP headers</value>
|
||||
public Multimap<string, string> Headers { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ApiException"/> class.
|
||||
/// </summary>
|
||||
@@ -51,10 +57,12 @@ namespace Org.OpenAPITools.Client
|
||||
/// <param name="errorCode">HTTP status code.</param>
|
||||
/// <param name="message">Error message.</param>
|
||||
/// <param name="errorContent">Error content.</param>
|
||||
public ApiException(int errorCode, string message, object errorContent = null) : base(message)
|
||||
/// <param name="headers">HTTP Headers.</param>
|
||||
public ApiException(int errorCode, string message, object errorContent = null, Multimap<string, string> headers = null) : base(message)
|
||||
{
|
||||
this.ErrorCode = errorCode;
|
||||
this.ErrorContent = errorContent;
|
||||
this.Headers = headers;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Org.OpenAPITools.Client
|
||||
{
|
||||
return new ApiException(status,
|
||||
string.Format("Error calling {0}: {1}", methodName, response.RawContent),
|
||||
response.RawContent);
|
||||
response.RawContent, response.Headers);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -30,6 +30,12 @@ namespace Org.OpenAPITools.Client
|
||||
/// <value>The error content (Http response body).</value>
|
||||
public object ErrorContent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the HTTP headers
|
||||
/// </summary>
|
||||
/// <value>HTTP headers</value>
|
||||
public Multimap<string, string> Headers { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ApiException"/> class.
|
||||
/// </summary>
|
||||
@@ -51,10 +57,12 @@ namespace Org.OpenAPITools.Client
|
||||
/// <param name="errorCode">HTTP status code.</param>
|
||||
/// <param name="message">Error message.</param>
|
||||
/// <param name="errorContent">Error content.</param>
|
||||
public ApiException(int errorCode, string message, object errorContent = null) : base(message)
|
||||
/// <param name="headers">HTTP Headers.</param>
|
||||
public ApiException(int errorCode, string message, object errorContent = null, Multimap<string, string> headers = null) : base(message)
|
||||
{
|
||||
this.ErrorCode = errorCode;
|
||||
this.ErrorContent = errorContent;
|
||||
this.Headers = headers;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Org.OpenAPITools.Client
|
||||
{
|
||||
return new ApiException(status,
|
||||
string.Format("Error calling {0}: {1}", methodName, response.RawContent),
|
||||
response.RawContent);
|
||||
response.RawContent, response.Headers);
|
||||
}
|
||||
if (status == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user