You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
cc @mkArtakMSFT, since you're working on WebApplicationFactory. What do you think about the solutions suggested by @aetos382?
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.
Is there an existing issue for this?
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 anHttpClient
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 byWebApplicationFactory.ConfigureClient
.I was using
ConfigureClient
to configure the client, but when I switched to usingRequestBuilder
, I was confused because that configuration did not work.Also,
TestServer
has CreateWebSocketClient, butWebApplicationFactory
does not.Thus, since
WebApplicationFactory
exposes only a portion ofTestServer
's functionality, developers may need to useTestServer
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
orWebSocketClient
should be exposed throughWebApplicationFactory
, so that their configuration byConfigureClient
is reflected.Also, there could be documentation or an analyzer that warns against using
ConfigureClient
andTestServer
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
The text was updated successfully, but these errors were encountered: