Skip to content

Commit d981470

Browse files
committed
HLR Feature
1 parent 9fed205 commit d981470

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

smsapi/Api/Response/Deserialization/BaseJsonDeserializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public DeserializationResult<T> Deserialize<T>(HttpResponseEntity responseEntity
1111
T result;
1212
var data = responseEntity.Content.Result;
1313

14-
if (data.Length > 0)
14+
if (data.Length > 0 && !responseEntity.IsEmptyContentCode)
1515
{
1616
data.Position = 0;
1717
var stringData = new StreamReader(data).ReadToEnd();
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
using System.Runtime.Serialization;
21
using SMSApi.Api.Response.ResponseResolver;
32

43
namespace SMSApi.Api.Response.HLR;
54

6-
[DataContract]
75
public readonly record struct SingleCheckResult : IResponseCodeAwareResolver;

smsapi/HttpResponseEntity.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
using System.IO;
2+
using System.Linq;
23
using System.Net;
34
using System.Threading.Tasks;
45

56
namespace SMSApi.Api
67
{
78
public readonly struct HttpResponseEntity
89
{
10+
private static readonly HttpStatusCode[] EmptyResponseCodes = { HttpStatusCode.Accepted, HttpStatusCode.NoContent };
11+
912
public readonly Task<Stream> Content;
1013
public readonly HttpStatusCode StatusCode;
1114

15+
public bool IsEmptyContentCode => EmptyResponseCodes.Contains(StatusCode);
16+
1217
public HttpResponseEntity(Task<Stream> content, HttpStatusCode statusCode)
1318
{
1419
Content = content;

0 commit comments

Comments
 (0)