Description
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
There are two ways to send HTTP requests to WebApplicationFactory.
One is to use WebApplicationFactory.CreateClient to obtain an HttpClient
, which will result in an HttpClient
that reflects the configuration by ConfigureClient.
The other is to use Server to obtain a TestServer, and then use TestServer.CreateClient to obtain an HttpClient
. This method has high-level functions such as RequestBuilder, but does not reflect the configuration by WebApplicationFactory.ConfigureClient
.
I was using ConfigureClient
to configure the client, but when I switched to using RequestBuilder
, I was confused because that configuration did not work.
Also, TestServer
has CreateWebSocketClient, but WebApplicationFactory
does not.
Thus, since WebApplicationFactory
exposes only a portion of TestServer
's functionality, developers may need to use TestServer
directly.
Describe the solution you'd like
I don't have a clear idea of what exactly should be done.
Maybe functions such as RequestBuilder
or WebSocketClient
should be exposed through WebApplicationFactory
, so that their configuration by ConfigureClient
is reflected.
Also, there could be documentation or an analyzer that warns against using ConfigureClient
and TestServer
together.
I am aware that the WebApplicationFactory
is currently being refactored.
I would appreciate it if you would also consider a fix to clarify this type of confusion.
Additional context
No response