HarEntryExtensions Class
Provides extension methods for converting HAR entries to HttpRequestMessage and HttpResponseMessage.
public static class HarEntryExtensionsMethods
| Name | Description |
|---|---|
| ToHttpRequestMessage(HarEntry) | Creates an HttpRequestMessage from a HAR entry. |
| ToHttpRequestMessage(HarRequest) | Creates an HttpRequestMessage from a HAR request. |
| ToHttpResponseMessage(HarEntry) | Creates an HttpResponseMessage from a HAR entry. |
| ToHttpResponseMessage(HarResponse) | Creates an HttpResponseMessage from a HAR response. |
ToHttpRequestMessage overloads
ToHttpRequestMessage(HarEntry)
HarEntryExtensions.csCreates an HttpRequestMessage from a HAR entry.
public static HttpRequestMessage ToHttpRequestMessage(this HarEntry entry)Parameters
entryHarEntry- The HAR entry to convert.
Returns
HttpRequestMessage An HttpRequestMessage representing the HAR request.
Exceptions
InvalidOperationException- The entry does not contain a request.
ToHttpRequestMessage(HarRequest)
HarEntryExtensions.csCreates an HttpRequestMessage from a HAR request.
public static HttpRequestMessage ToHttpRequestMessage(this HarRequest request)Parameters
requestHarRequest- The HAR request to convert.
Returns
HttpRequestMessage An HttpRequestMessage representing the HAR request.
Exceptions
InvalidOperationException- The request does not contain a method or a URL.
Remarks
When the archive recorded the body as params instead of text, a application/x-www-form-urlencoded body is rebuilt from the parameters. Multipart bodies cannot be rebuilt this way because the original boundary is not part of the archive; they convert to an empty body.
ToHttpResponseMessage overloads
ToHttpResponseMessage(HarEntry)
HarEntryExtensions.csCreates an HttpResponseMessage from a HAR entry.
public static HttpResponseMessage ToHttpResponseMessage(this HarEntry entry)Parameters
entryHarEntry- The HAR entry to convert.
Returns
HttpResponseMessage An HttpResponseMessage representing the HAR response.
Exceptions
InvalidOperationException- The entry does not contain a response.
ToHttpResponseMessage(HarResponse)
HarEntryExtensions.csCreates an HttpResponseMessage from a HAR response.
public static HttpResponseMessage ToHttpResponseMessage(this HarResponse response)Parameters
responseHarResponse- The HAR response to convert.
Returns
HttpResponseMessage An HttpResponseMessage representing the HAR response.