remove deprecated restsharp parameter class (#8933)

This commit is contained in:
William Cheng 2021-03-10 14:51:23 +08:00 committed by GitHub
parent 952483abde
commit f56dd9f59b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 20 deletions

View File

@ -95,8 +95,6 @@ namespace {{packageName}}.Client
/// <returns>Object representation of the JSON string.</returns> /// <returns>Object representation of the JSON string.</returns>
internal object Deserialize(IRestResponse response, Type type) internal object Deserialize(IRestResponse response, Type type)
{ {
IList<Parameter> headers = response.Headers;
if (type == typeof(byte[])) // return byte array if (type == typeof(byte[])) // return byte array
{ {
return response.RawBytes; return response.RawBytes;
@ -106,13 +104,13 @@ namespace {{packageName}}.Client
if (type == typeof(Stream)) if (type == typeof(Stream))
{ {
var bytes = response.RawBytes; var bytes = response.RawBytes;
if (headers != null) if (response.Headers != null)
{ {
var filePath = String.IsNullOrEmpty(_configuration.TempFolderPath) var filePath = String.IsNullOrEmpty(_configuration.TempFolderPath)
? Path.GetTempPath() ? Path.GetTempPath()
: _configuration.TempFolderPath; : _configuration.TempFolderPath;
var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$");
foreach (var header in headers) foreach (var header in response.Headers)
{ {
var match = regex.Match(header.ToString()); var match = regex.Match(header.ToString());
if (match.Success) if (match.Success)

View File

@ -96,8 +96,6 @@ namespace Org.OpenAPITools.Client
/// <returns>Object representation of the JSON string.</returns> /// <returns>Object representation of the JSON string.</returns>
internal object Deserialize(IRestResponse response, Type type) internal object Deserialize(IRestResponse response, Type type)
{ {
IList<Parameter> headers = response.Headers;
if (type == typeof(byte[])) // return byte array if (type == typeof(byte[])) // return byte array
{ {
return response.RawBytes; return response.RawBytes;
@ -107,13 +105,13 @@ namespace Org.OpenAPITools.Client
if (type == typeof(Stream)) if (type == typeof(Stream))
{ {
var bytes = response.RawBytes; var bytes = response.RawBytes;
if (headers != null) if (response.Headers != null)
{ {
var filePath = String.IsNullOrEmpty(_configuration.TempFolderPath) var filePath = String.IsNullOrEmpty(_configuration.TempFolderPath)
? Path.GetTempPath() ? Path.GetTempPath()
: _configuration.TempFolderPath; : _configuration.TempFolderPath;
var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$");
foreach (var header in headers) foreach (var header in response.Headers)
{ {
var match = regex.Match(header.ToString()); var match = regex.Match(header.ToString());
if (match.Success) if (match.Success)

View File

@ -96,8 +96,6 @@ namespace Org.OpenAPITools.Client
/// <returns>Object representation of the JSON string.</returns> /// <returns>Object representation of the JSON string.</returns>
internal object Deserialize(IRestResponse response, Type type) internal object Deserialize(IRestResponse response, Type type)
{ {
IList<Parameter> headers = response.Headers;
if (type == typeof(byte[])) // return byte array if (type == typeof(byte[])) // return byte array
{ {
return response.RawBytes; return response.RawBytes;
@ -107,13 +105,13 @@ namespace Org.OpenAPITools.Client
if (type == typeof(Stream)) if (type == typeof(Stream))
{ {
var bytes = response.RawBytes; var bytes = response.RawBytes;
if (headers != null) if (response.Headers != null)
{ {
var filePath = String.IsNullOrEmpty(_configuration.TempFolderPath) var filePath = String.IsNullOrEmpty(_configuration.TempFolderPath)
? Path.GetTempPath() ? Path.GetTempPath()
: _configuration.TempFolderPath; : _configuration.TempFolderPath;
var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$");
foreach (var header in headers) foreach (var header in response.Headers)
{ {
var match = regex.Match(header.ToString()); var match = regex.Match(header.ToString());
if (match.Success) if (match.Success)

View File

@ -95,8 +95,6 @@ namespace Org.OpenAPITools.Client
/// <returns>Object representation of the JSON string.</returns> /// <returns>Object representation of the JSON string.</returns>
internal object Deserialize(IRestResponse response, Type type) internal object Deserialize(IRestResponse response, Type type)
{ {
IList<Parameter> headers = response.Headers;
if (type == typeof(byte[])) // return byte array if (type == typeof(byte[])) // return byte array
{ {
return response.RawBytes; return response.RawBytes;
@ -106,13 +104,13 @@ namespace Org.OpenAPITools.Client
if (type == typeof(Stream)) if (type == typeof(Stream))
{ {
var bytes = response.RawBytes; var bytes = response.RawBytes;
if (headers != null) if (response.Headers != null)
{ {
var filePath = String.IsNullOrEmpty(_configuration.TempFolderPath) var filePath = String.IsNullOrEmpty(_configuration.TempFolderPath)
? Path.GetTempPath() ? Path.GetTempPath()
: _configuration.TempFolderPath; : _configuration.TempFolderPath;
var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$");
foreach (var header in headers) foreach (var header in response.Headers)
{ {
var match = regex.Match(header.ToString()); var match = regex.Match(header.ToString());
if (match.Success) if (match.Success)

View File

@ -96,8 +96,6 @@ namespace Org.OpenAPITools.Client
/// <returns>Object representation of the JSON string.</returns> /// <returns>Object representation of the JSON string.</returns>
internal object Deserialize(IRestResponse response, Type type) internal object Deserialize(IRestResponse response, Type type)
{ {
IList<Parameter> headers = response.Headers;
if (type == typeof(byte[])) // return byte array if (type == typeof(byte[])) // return byte array
{ {
return response.RawBytes; return response.RawBytes;
@ -107,13 +105,13 @@ namespace Org.OpenAPITools.Client
if (type == typeof(Stream)) if (type == typeof(Stream))
{ {
var bytes = response.RawBytes; var bytes = response.RawBytes;
if (headers != null) if (response.Headers != null)
{ {
var filePath = String.IsNullOrEmpty(_configuration.TempFolderPath) var filePath = String.IsNullOrEmpty(_configuration.TempFolderPath)
? Path.GetTempPath() ? Path.GetTempPath()
: _configuration.TempFolderPath; : _configuration.TempFolderPath;
var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$");
foreach (var header in headers) foreach (var header in response.Headers)
{ {
var match = regex.Match(header.ToString()); var match = regex.Match(header.ToString());
if (match.Success) if (match.Success)