Skip to content

Commit 5e3688f

Browse files
committed
Add missing test
1 parent d90fba1 commit 5e3688f

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithHeadersTests.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,27 @@ public async Task ShouldVerifyStringHeaders()
157157

158158
await That(result.StatusCode).IsEqualTo(HttpStatusCode.OK);
159159
}
160+
161+
[Fact]
162+
public async Task WithInvalidStringHeader_ShouldThrowArgumentException()
163+
{
164+
HttpClient httpClient = Mock.Create<HttpClient>();
165+
166+
void Act()
167+
{
168+
httpClient.SetupMock.Method
169+
.PostAsync(It.IsAny<Uri>(), It.IsHttpContent()
170+
.WithHeaders("""
171+
x-myHeader1: foo
172+
x-myHeader2
173+
x-myHeader3: baz
174+
"""))
175+
.ReturnsAsync(new HttpResponseMessage(HttpStatusCode.OK));
176+
}
177+
178+
await That(Act).Throws<ArgumentException>()
179+
.WithMessage("The header contained an invalid line: x-myHeader2");
180+
}
160181
}
161182
}
162183
}

0 commit comments

Comments
 (0)