NoBodyResponse<T>
NOTE: This type should not be used going forward. Use NoValueResponse{T} instead.
using System;
namespace Azure
{
internal class NoBodyResponse<T>
{
private class ResponseBodyNotFoundException : Exception
{
public int Status { get; }
public ResponseBodyNotFoundException(int status, string message)
: base(message)
{
Status = status;
}
}
private readonly Response _response;
public override bool HasValue => false;
public override T Value {
get {
throw new ResponseBodyNotFoundException(_response.get_Status(), _response.get_ReasonPhrase());
}
}
public NoBodyResponse(Response response)
{
_response = response;
}
public override Response GetRawResponse()
{
return _response;
}
public override string ToString()
{
return $"""{this.GetRawResponse().get_Status()}""";
}
}
}