Skip to content

Commit f35af99

Browse files
committed
Include full response object in ApiException
1 parent c56afb2 commit f35af99

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiException.mustache

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// <auto-generated>
22
{{>partial_header}}
3-
43
{{#nrt}}
54
#nullable enable
65

76
{{/nrt}}
87
using System;
8+
using System.IO;
99

1010
namespace {{packageName}}.{{clientPackage}}
1111
{
@@ -28,20 +28,27 @@ namespace {{packageName}}.{{clientPackage}}
2828
/// The raw data returned by the api
2929
/// </summary>
3030
public string RawContent { get; }
31+
32+
/// <summary>
33+
/// The HttpResponseMessage object
34+
/// </summary>
35+
public System.Net.Http.HttpResponseMessage? RawResponse { get; }
3136

3237
/// <summary>
3338
/// Construct the ApiException from parts of the response
3439
/// </summary>
3540
/// <param name="reasonPhrase"></param>
3641
/// <param name="statusCode"></param>
3742
/// <param name="rawContent"></param>
38-
public ApiException(string{{nrt?}} reasonPhrase, System.Net.HttpStatusCode statusCode, string rawContent) : base(reasonPhrase ?? rawContent)
43+
public ApiException(string{{nrt?}} reasonPhrase, System.Net.HttpStatusCode statusCode, string rawContent, System.Net.Http.HttpResponseMessage? rawResponse = null) : base(reasonPhrase ?? rawContent)
3944
{
4045
ReasonPhrase = reasonPhrase;
4146
4247
StatusCode = statusCode;
4348
4449
RawContent = rawContent;
50+
51+
RawResponse = rawResponse;
4552
}
4653
}
4754
}

0 commit comments

Comments
 (0)