RequestBuilder Class¶
Used to construct a HttpRequestMessage object.
- Namespace
Microsoft.AspNetCore.TestHost- Assemblies
- Microsoft.AspNetCore.TestHost
Constructors¶
-
RequestBuilder(Microsoft.AspNetCore.TestHost.TestServer, System.String)¶ Construct a new HttpRequestMessage with the given path.
public RequestBuilder(TestServer server, string path)
-
Methods¶
-
AddHeader(System.String, System.String)¶ Add the given header and value to the request or request content.
Return type: Microsoft.AspNetCore.TestHost.RequestBuilder public RequestBuilder AddHeader(string name, string value)
-
And(System.Action<System.Net.Http.HttpRequestMessage>)¶ Configure any HttpRequestMessage properties.
Return type: Microsoft.AspNetCore.TestHost.RequestBuilder public RequestBuilder And(Action<HttpRequestMessage> configure)
-
GetAsync()¶ Set the request method to GET and start processing the request.
Return type: System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> public Task<HttpResponseMessage> GetAsync()
-
PostAsync()¶ Set the request method to POST and start processing the request.
Return type: System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> public Task<HttpResponseMessage> PostAsync()
-
SendAsync(System.String)¶ Set the request method and start processing the request.
Return type: System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> public Task<HttpResponseMessage> SendAsync(string method)
-