1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-10-27 00:17:31 +00:00
Jkorf d44a11c44e HttpVersion update
Added LibraryHelpers.CreateHttpClientMessageHandle to standardize HttpMessageHandler creation
Added REST client option for selecting HTTP protocol version
Added REST client option for HTTP client keep alive interval
Added HttpVersion to WebCallResult responses
Updated request logic to default to using HTTP version 2.0 for dotnet core
2025-09-01 10:12:59 +02:00

38 lines
1007 B
C#

using CryptoExchange.Net.Interfaces;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Threading.Tasks;
namespace CryptoExchange.Net.Testing.Implementations
{
internal class TestResponse : IResponse
{
private readonly Stream _response;
public HttpStatusCode StatusCode { get; }
public Version HttpVersion { get; }
public bool IsSuccessStatusCode { get; }
public long? ContentLength { get; }
public KeyValuePair<string, string[]>[] ResponseHeaders { get; } = new KeyValuePair<string, string[]>[0];
public TestResponse(HttpStatusCode code, Stream response)
{
StatusCode = code;
HttpVersion = new Version(2, 0);
IsSuccessStatusCode = code == HttpStatusCode.OK;
_response = response;
}
public void Close()
{
}
public Task<Stream> GetResponseStreamAsync() => Task.FromResult(_response);
}
}