We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d90fba1 commit 5e3688fCopy full SHA for 5e3688f
1 file changed
Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithHeadersTests.cs
@@ -157,6 +157,27 @@ public async Task ShouldVerifyStringHeaders()
157
158
await That(result.StatusCode).IsEqualTo(HttpStatusCode.OK);
159
}
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
181
182
183
0 commit comments