-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
The following code in BlazorTest is failing when a content header (such as Content-Type) is present on the request. This is preventing testing POST / PUT requests:
foreach (var header in request.Headers)
{
requestMessage.Headers.Add(header.Key, header.Value);
}The following works, but feels a bit of a bodge:
foreach (var header in request.Headers)
{
if (!requestMessage.Headers.TryAddWithoutValidation(header.Key, header.Value))
{
// Populate content headers if they are not added to request headers
requestMessage.Content?.Headers.TryAddWithoutValidation(header.Key, header.Value);
}
}I've also got this working a bit more elegantly by maintaining a collection of known content headers to use for conditional population.
Metadata
Metadata
Assignees
Labels
No labels