Skip to content

Commit c1faf67

Browse files
author
Jeff Espenschied
committed
Added ProtocolVersion to RestResponse.
It is only set in FRAMEWORK builds, but is available as the default on any platform.
1 parent 0ef81fd commit c1faf67

File tree

6 files changed

+26
-0
lines changed

6 files changed

+26
-0
lines changed

RestSharp/Http.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ private void ExtractResponseData(HttpResponse response, HttpWebResponse webRespo
404404
#if FRAMEWORK
405405
response.ContentEncoding = webResponse.ContentEncoding;
406406
response.Server = webResponse.Server;
407+
response.ProtocolVersion = webResponse.ProtocolVersion;
407408
#endif
408409
response.ContentType = webResponse.ContentType;
409410
response.ContentLength = webResponse.ContentLength;

RestSharp/HttpResponse.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,11 @@ public string Content
113113
/// Exception thrown when error is encountered.
114114
/// </summary>
115115
public Exception ErrorException { get; set; }
116+
117+
/// <summary>
118+
/// The HTTP protocol version (1.0, 1.1, etc)
119+
/// </summary>
120+
/// <remarks>Only set when underlying framework supports it.</remarks>
121+
public Version ProtocolVersion { get; set; }
116122
}
117123
}

RestSharp/IHttpResponse.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,11 @@ public interface IHttpResponse
7979
/// Exception thrown when error is encountered.
8080
/// </summary>
8181
Exception ErrorException { get; set; }
82+
83+
/// <summary>
84+
/// The HTTP protocol version (1.0, 1.1, etc)
85+
/// </summary>
86+
/// <remarks>Only set when underlying framework supports it.</remarks>
87+
Version ProtocolVersion { get; set; }
8288
}
8389
}

RestSharp/IRestResponse.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ public interface IRestResponse
8989
/// <remarks>Will contain only network transport or framework exceptions thrown during the request.
9090
/// HTTP protocol errors are handled by RestSharp and will not appear here.</remarks>
9191
Exception ErrorException { get; set; }
92+
93+
/// <summary>
94+
/// The HTTP protocol version (1.0, 1.1, etc)
95+
/// </summary>
96+
/// <remarks>Only set when underlying framework supports it.</remarks>
97+
Version ProtocolVersion { get; set; }
9298
}
9399

94100
/// <summary>

RestSharp/RestClient.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ private static RestResponse ConvertToRestResponse(IRestRequest request, HttpResp
565565
RawBytes = httpResponse.RawBytes,
566566
ResponseStatus = httpResponse.ResponseStatus,
567567
ResponseUri = httpResponse.ResponseUri,
568+
ProtocolVersion = httpResponse.ProtocolVersion,
568569
Server = httpResponse.Server,
569570
StatusCode = httpResponse.StatusCode,
570571
StatusDescription = httpResponse.StatusDescription,

RestSharp/RestResponse.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ public string Content
126126
/// </summary>
127127
public Exception ErrorException { get; set; }
128128

129+
/// <summary>
130+
/// The HTTP protocol version (1.0, 1.1, etc)
131+
/// </summary>
132+
/// <remarks>Only set when underlying framework supports it.</remarks>
133+
public Version ProtocolVersion { get; set; }
129134

130135
/// <summary>
131136
/// Assists with debugging responses by displaying in the debugger output
@@ -164,6 +169,7 @@ public static explicit operator RestResponse<T>(RestResponse response)
164169
RawBytes = response.RawBytes,
165170
ResponseStatus = response.ResponseStatus,
166171
ResponseUri = response.ResponseUri,
172+
ProtocolVersion = response.ProtocolVersion,
167173
Server = response.Server,
168174
StatusCode = response.StatusCode,
169175
StatusDescription = response.StatusDescription,

0 commit comments

Comments
 (0)