Fix null reference access when ContentType is null (#2501)

This commit is contained in:
Diogo Rolo
2022-07-21 22:36:02 +01:00
committed by GitHub
parent cc56183da8
commit 4f4ef5ba73
2 changed files with 12 additions and 1 deletions
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
#if !NO_SERIALIZABLE
@@ -141,6 +142,16 @@ namespace Octokit.Tests.Exceptions
Assert.NotNull(stringRepresentation);
}
[Fact]
public void DoesNotThrowIfContentTypeIsNotDefined()
{
var response = CreateResponse(HttpStatusCode.GatewayTimeout, null, new Dictionary<string, string>(), null);
var exception = new ApiException(response);
var stringRepresentation = exception.ToString();
Assert.NotNull(stringRepresentation);
}
[Fact]
public void DoesNotPrintImageContent()
{