HttpClient Clase
Definición
Proporciona una clase para enviar solicitudes HTTP y recibir respuestas HTTP de un recurso identificado por un URI.Provides a class for sending HTTP requests and receiving HTTP responses from a resource identified by a URI.
public ref class HttpClient : System::Net::Http::HttpMessageInvoker
public class HttpClient : System.Net.Http.HttpMessageInvoker
type HttpClient = class
inherit HttpMessageInvoker
Public Class HttpClient
Inherits HttpMessageInvoker
- Herencia
Ejemplos
// HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
static readonly HttpClient client = new HttpClient();
static async Task Main()
{
// Call asynchronous network methods in a try/catch block to handle exceptions.
try
{
HttpResponseMessage response = await client.GetAsync("http://www.contoso.com/");
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
// Above three lines can be replaced with new helper method below
// string responseBody = await client.GetStringAsync(uri);
Console.WriteLine(responseBody);
}
catch(HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ",e.Message);
}
}
' HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
Shared ReadOnly client As HttpClient = New HttpClient()
Private Shared Async Function Main() As Task
' Call asynchronous network methods in a try/catch block to handle exceptions.
Try
Dim response As HttpResponseMessage = Await client.GetAsync("http://www.contoso.com/")
response.EnsureSuccessStatusCode()
Dim responseBody As String = Await response.Content.ReadAsStringAsync()
' Above three lines can be replaced with new helper method below
' Dim responseBody As String = Await client.GetStringAsync(uri)
Console.WriteLine(responseBody)
Catch e As HttpRequestException
Console.WriteLine(Environment.NewLine & "Exception Caught!")
Console.WriteLine("Message :{0} ", e.Message)
End Try
End Function
En el ejemplo de código anterior se usa un async Task Main() punto de entrada.The preceding code example uses an async Task Main() entry point. Esta característica requiere C# 7,1 o posterior.That feature requires C# 7.1 or later.
Comentarios
La HttpClient instancia de clase actúa como una sesión para enviar solicitudes HTTP.The HttpClient class instance acts as a session to send HTTP requests. Una HttpClient instancia de es una colección de valores de configuración que se aplican a todas las solicitudes ejecutadas por esa instancia.An HttpClient instance is a collection of settings applied to all requests executed by that instance. Además, cada HttpClient instancia usa su propio grupo de conexiones, aislando sus solicitudes de solicitudes ejecutadas por otras HttpClient instancias.In addition, every HttpClient instance uses its own connection pool, isolating its requests from requests executed by other HttpClient instances.
Las clases derivadas no deben invalidar los métodos virtuales en la clase.Derived classes should not override the virtual methods on the class. En su lugar, utilice una sobrecarga del constructor que acepte HttpMessageHandler para configurar el procesamiento previo o posterior a la solicitud.Instead, use a constructor overload that accepts HttpMessageHandler to configure any pre- or post-request processing.
De forma predeterminada, en .NET Framework y mono, HttpWebRequest se usa para enviar solicitudes al servidor.By default on .NET Framework and Mono, HttpWebRequest is used to send requests to the server. Este comportamiento se puede modificar especificando un canal diferente en una de las sobrecargas del constructor que toman una HttpMessageHandler instancia como parámetro.This behavior can be modified by specifying a different channel in one of the constructor overloads taking a HttpMessageHandler instance as parameter. Si se requieren características como la autenticación o el almacenamiento en caché, WebRequestHandler se puede usar para configurar las opciones y la instancia se puede pasar al constructor.If features like authentication or caching are required, WebRequestHandler can be used to configure settings and the instance can be passed to the constructor. El controlador devuelto se puede pasar a una de las sobrecargas del constructor que toman un HttpMessageHandler parámetro.The returned handler can be passed to one of the constructor overloads taking a HttpMessageHandler parameter.
Si una aplicación HttpClient que usa y las clases relacionadas en el System.Net.Http espacio de nombres pretende descargar grandes cantidades de datos (50 megabytes o más), la aplicación debe transmitir esas descargas y no usar el almacenamiento en búfer predeterminado.If an app using HttpClient and related classes in the System.Net.Http namespace intends to download large amounts of data (50 megabytes or more), then the app should stream those downloads and not use the default buffering. Si se utiliza el almacenamiento en búfer predeterminado, el uso de memoria del cliente será muy grande, lo que podría dar lugar a un rendimiento notablemente reducido.If the default buffering is used the client memory usage will get very large, potentially resulting in substantially reduced performance.
Las propiedades de HttpClient no se deben modificar mientras haya solicitudes pendientes, ya que no es segura para subprocesos.Properties of HttpClient should not be modified while there are outstanding requests, because it is not thread-safe.
Los métodos siguientes son seguros para subprocesos:The following methods are thread safe:
HttpClient está diseñado para que se cree una instancia de una vez y se vuelva a usar a lo largo de la vida de una aplicación.HttpClient is intended to be instantiated once and re-used throughout the life of an application. La creación de instancias de una clase HttpClient para cada solicitud agotará el número de sockets disponibles en cargas pesadas.Instantiating an HttpClient class for every request will exhaust the number of sockets available under heavy loads. Esto producirá errores de SocketException.This will result in SocketException errors. A continuación se muestra un ejemplo de uso de HttpClient correctamente.Below is an example using HttpClient correctly.
public class GoodController : ApiController
{
private static readonly HttpClient HttpClient;
static GoodController()
{
HttpClient = new HttpClient();
}
}
Public Class GoodController
Inherits ApiController
Private Shared ReadOnly HttpClient As HttpClient
Shared Sub New()
HttpClient = New HttpClient()
End Sub
End Class
HttpClientEs una API de alto nivel que contiene la funcionalidad de nivel inferior disponible en cada plataforma en la que se ejecuta.The HttpClient is a high-level API that wraps the lower-level functionality available on each platform where it runs.
En cada plataforma, HttpClient intenta usar el mejor transporte disponible:On each platform, HttpClient tries to use the best available transport:
| Host/tiempo de ejecuciónHost/Runtime | Back-endBackend |
|---|---|
| Windows/.NET FrameworkWindows/.NET Framework | HttpWebRequest |
| Windows/monoWindows/Mono | HttpWebRequest |
| Windows/UWPWindows/UWP | Windows nativo WinHttpHandler (compatible con HTTP 2,0)Windows native WinHttpHandler (HTTP 2.0 capable) |
| Windows/.net Core 1.0-2.0Windows/.NET Core 1.0-2.0 | Windows nativo WinHttpHandler (compatible con HTTP 2,0)Windows native WinHttpHandler (HTTP 2.0 capable) |
| Android/XamarinAndroid/Xamarin | Seleccionado en tiempo de compilación.Selected at build-time. Puede usar HttpWebRequest o estar configurado para usar el nativo de Android HttpURLConnectionCan either use HttpWebRequest or be configured to use Android's native HttpURLConnection |
| iOS, tvOS, watchos/XamariniOS, tvOS, watchOS/Xamarin | Seleccionado en tiempo de compilación.Selected at build-time. Puede usar HttpWebRequest o estar configurado para usar Apple NSUrlSession (compatible con http 2,0).Can either use HttpWebRequest or be configured to use Apple's NSUrlSession (HTTP 2.0 capable) |
| macOS/XamarinmacOS/Xamarin | Seleccionado en tiempo de compilación.Selected at build-time. Puede usar HttpWebRequest o estar configurado para usar Apple NSUrlSession (compatible con http 2,0).Can either use HttpWebRequest or be configured to use Apple's NSUrlSession (HTTP 2.0 capable) |
| macOS/monomacOS/Mono | HttpWebRequest |
| macOS/.net Core 1.0-2.0macOS/.NET Core 1.0-2.0 | libcurltransporte HTTP basado en (compatible con HTTP 2,0)libcurl-based HTTP transport (HTTP 2.0 capable) |
| Linux/monoLinux/Mono | HttpWebRequest |
| Linux/.net Core 1.0-2.0Linux/.NET Core 1.0-2.0 | libcurltransporte HTTP basado en (compatible con HTTP 2,0)libcurl-based HTTP transport (HTTP 2.0 capable) |
| .NET Core 2,1 y versiones posteriores.NET Core 2.1 and later | System.Net.Http.SocketsHttpHandler |
Los usuarios también pueden configurar un transporte específico para HttpClient invocando el HttpClient constructor que toma un HttpMessageHandler .Users can also configure a specific transport for HttpClient by invoking the HttpClient constructor that takes an HttpMessageHandler.
HttpClient y .NET CoreHttpClient and .NET Core
A partir de .NET Core 2,1, la System.Net.Http.SocketsHttpHandler clase en lugar de HttpClientHandler proporciona la implementación utilizada por las clases de red http de nivel superior, como HttpClient .Starting with .NET Core 2.1, the System.Net.Http.SocketsHttpHandler class instead of HttpClientHandler provides the implementation used by higher-level HTTP networking classes such as HttpClient. El uso de SocketsHttpHandler ofrece una serie de ventajas:The use of SocketsHttpHandler offers a number of advantages:
- Una mejora significativa del rendimiento en comparación con la implementación anterior.A significant performance improvement when compared with the previous implementation.
- La eliminación de las dependencias de la plataforma, lo que simplifica la implementación y el mantenimiento.The elimination of platform dependencies, which simplifies deployment and servicing. Por ejemplo, ya
libcurlno es una dependencia de .net Core para MacOS y .net Core para Linux.For example,libcurlis no longer a dependency on .NET Core for macOS and .NET Core for Linux. - Comportamiento coherente en todas las plataformas de .NET.Consistent behavior across all .NET platforms.
Si no desea este cambio, en Windows todavía puede usar WinHttpHandler haciendo referencia a su paquete de NuGet y pasándolo al HttpClient constructor de manualmente.If this change is undesirable, on Windows you can still use WinHttpHandler by referencing it's NuGet package and passing it to HttpClient's constructor manually.
Configurar el comportamiento mediante opciones de configuración en tiempo de ejecuciónConfigure behavior using run-time configuration options
Algunos aspectos del HttpClient comportamiento de se pueden personalizar a través de las opciones de configuración en tiempo de ejecución.Certain aspects of HttpClient's behavior are customizable through Run-time configuration options. Sin embargo, el comportamiento de estos modificadores difiere en las versiones de .NET.However, the behavior of these switches differs through .NET versions. Por ejemplo, en .NET Core 2,1-3,1, puede configurar si SocketsHttpHandler se usa de forma predeterminada, pero esa opción ya no está disponible a partir de .net 5,0.For example, in .NET Core 2.1 - 3.1, you can configure whether SocketsHttpHandler is used by default, but that option is no longer available starting in .NET 5.0.
Constructores
| HttpClient() |
Inicializa una nueva instancia de la clase HttpClient mediante un controlador HttpClientHandler que se elimina cuando se elimina esta instancia.Initializes a new instance of the HttpClient class using a HttpClientHandler that is disposed when this instance is disposed. |
| HttpClient(HttpMessageHandler) |
Inicializa una nueva instancia de la clase HttpClient con el controlador especificado.Initializes a new instance of the HttpClient class with the specified handler. El controlador se elimina cuando se elimina esta instancia.The handler is disposed when this instance is disposed. |
| HttpClient(HttpMessageHandler, Boolean) |
Inicializa una nueva instancia de la clase HttpClient con el controlador proporcionado y especifica si se debe eliminar ese controlador cuando se elimine esta instancia.Initializes a new instance of the HttpClient class with the provided handler, and specifies whether that handler should be disposed when this instance is disposed. |
Propiedades
| BaseAddress |
Obtiene o establece la dirección base de Identificador uniforme de recursos (URI) del recurso de Internet utilizado cuando se envían solicitudes.Gets or sets the base address of Uniform Resource Identifier (URI) of the Internet resource used when sending requests. |
| DefaultProxy |
Obtiene o establece el proxy HTTP global.Gets or sets the global Http proxy. |
| DefaultRequestHeaders |
Obtiene los encabezados que se deben enviar con cada solicitud.Gets the headers which should be sent with each request. |
| DefaultRequestVersion |
Obtiene o establece la versión HTTP predeterminada utilizada en las solicitudes posteriores realizadas por esta instancia de HttpClient.Gets or sets the default HTTP version used on subsequent requests made by this HttpClient instance. |
| DefaultVersionPolicy |
Obtiene o establece la directiva de versión predeterminada para solicitudes creadas implícitamente en métodos de conveniencia, por ejemplo, GetAsync(String) y PostAsync(String, HttpContent).Gets or sets the default version policy for implicitly created requests in convenience methods, for example, GetAsync(String) and PostAsync(String, HttpContent). |
| MaxResponseContentBufferSize |
Obtiene o establece el número máximo de bytes que se van a almacenar en búfer al leer el contenido de la respuesta.Gets or sets the maximum number of bytes to buffer when reading the response content. |
| Timeout |
Obtiene o establece el tiempo de espera hasta que se agota el tiempo de espera de la solicitud.Gets or sets the timespan to wait before the request times out. |
Métodos
| CancelPendingRequests() |
Cancela todas las solicitudes pendientes en esta instancia.Cancel all pending requests on this instance. |
| DeleteAsync(String) |
Envía una solicitud DELETE al URI especificado como una operación asincrónica.Send a DELETE request to the specified Uri as an asynchronous operation. |
| DeleteAsync(String, CancellationToken) |
Envía una solicitud DELETE al URI especificado con un token de cancelación como operación asincrónica.Send a DELETE request to the specified Uri with a cancellation token as an asynchronous operation. |
| DeleteAsync(Uri) |
Envía una solicitud DELETE al URI especificado como una operación asincrónica.Send a DELETE request to the specified Uri as an asynchronous operation. |
| DeleteAsync(Uri, CancellationToken) |
Envía una solicitud DELETE al URI especificado con un token de cancelación como operación asincrónica.Send a DELETE request to the specified Uri with a cancellation token as an asynchronous operation. |
| Dispose() |
Libera los recursos no administrados y desecha los recursos administrados que usa HttpMessageInvoker.Releases the unmanaged resources and disposes of the managed resources used by the HttpMessageInvoker. (Heredado de HttpMessageInvoker) |
| Dispose(Boolean) |
Libera los recursos no administrados que usa el objeto HttpClient y, de forma opcional, desecha los recursos administrados.Releases the unmanaged resources used by the HttpClient and optionally disposes of the managed resources. |
| Equals(Object) |
Determina si el objeto especificado es igual que el objeto actual.Determines whether the specified object is equal to the current object. (Heredado de Object) |
| GetAsync(String) |
Envía una solicitud GET al URI especificado como una operación asincrónica.Send a GET request to the specified Uri as an asynchronous operation. |
| GetAsync(String, CancellationToken) |
Envía una solicitud GET al URI especificado con un token de cancelación como operación asincrónica.Send a GET request to the specified Uri with a cancellation token as an asynchronous operation. |
| GetAsync(String, HttpCompletionOption) |
Envía una solicitud GET al URI especificado con una opción de finalización de HTTP como operación asincrónica.Send a GET request to the specified Uri with an HTTP completion option as an asynchronous operation. |
| GetAsync(String, HttpCompletionOption, CancellationToken) |
Envía una solicitud GET al URI especificado con una opción de finalización de HTTP y un token de cancelación como operación asincrónica.Send a GET request to the specified Uri with an HTTP completion option and a cancellation token as an asynchronous operation. |
| GetAsync(Uri) |
Envía una solicitud GET al URI especificado como una operación asincrónica.Send a GET request to the specified Uri as an asynchronous operation. |
| GetAsync(Uri, CancellationToken) |
Envía una solicitud GET al URI especificado con un token de cancelación como operación asincrónica.Send a GET request to the specified Uri with a cancellation token as an asynchronous operation. |
| GetAsync(Uri, HttpCompletionOption) |
Envía una solicitud GET al URI especificado con una opción de finalización de HTTP como operación asincrónica.Send a GET request to the specified Uri with an HTTP completion option as an asynchronous operation. |
| GetAsync(Uri, HttpCompletionOption, CancellationToken) |
Envía una solicitud GET al URI especificado con una opción de finalización de HTTP y un token de cancelación como operación asincrónica.Send a GET request to the specified Uri with an HTTP completion option and a cancellation token as an asynchronous operation. |
| GetByteArrayAsync(String) |
Envía una solicitud GET al URI especificado y devuelve el cuerpo de la respuesta como una matriz de bytes en una operación asincrónica.Sends a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation. |
| GetByteArrayAsync(String, CancellationToken) |
Envía una solicitud GET al URI especificado y devuelve el cuerpo de la respuesta como una matriz de bytes en una operación asincrónica.Sends a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation. |
| GetByteArrayAsync(Uri) |
Envía una solicitud GET al URI especificado y devuelve el cuerpo de la respuesta como una matriz de bytes en una operación asincrónica.Send a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation. |
| GetByteArrayAsync(Uri, CancellationToken) |
Envía una solicitud GET al URI especificado y devuelve el cuerpo de la respuesta como una matriz de bytes en una operación asincrónica.Send a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation. |
| GetHashCode() |
Sirve como la función hash predeterminada.Serves as the default hash function. (Heredado de Object) |
| GetStreamAsync(String) |
Envía una solicitud GET al URI especificado y devuelve el cuerpo de la respuesta como una secuencia en una operación asincrónica.Send a GET request to the specified Uri and return the response body as a stream in an asynchronous operation. |
| GetStreamAsync(String, CancellationToken) |
Envía una solicitud GET al URI especificado y devuelve el cuerpo de la respuesta como una secuencia en una operación asincrónica.Send a GET request to the specified Uri and return the response body as a stream in an asynchronous operation. |
| GetStreamAsync(Uri) |
Envía una solicitud GET al URI especificado y devuelve el cuerpo de la respuesta como una secuencia en una operación asincrónica.Send a GET request to the specified Uri and return the response body as a stream in an asynchronous operation. |
| GetStreamAsync(Uri, CancellationToken) |
Envía una solicitud GET al URI especificado y devuelve el cuerpo de la respuesta como una secuencia en una operación asincrónica.Send a GET request to the specified Uri and return the response body as a stream in an asynchronous operation. |
| GetStringAsync(String) |
Envía una solicitud GET al URI especificado y devuelve el cuerpo de la respuesta como una cadena en una operación asincrónica.Send a GET request to the specified Uri and return the response body as a string in an asynchronous operation. |
| GetStringAsync(String, CancellationToken) |
Envía una solicitud GET al URI especificado y devuelve el cuerpo de la respuesta como una cadena en una operación asincrónica.Send a GET request to the specified Uri and return the response body as a string in an asynchronous operation. |
| GetStringAsync(Uri) |
Envía una solicitud GET al URI especificado y devuelve el cuerpo de la respuesta como una cadena en una operación asincrónica.Send a GET request to the specified Uri and return the response body as a string in an asynchronous operation. |
| GetStringAsync(Uri, CancellationToken) |
Envía una solicitud GET al URI especificado y devuelve el cuerpo de la respuesta como una cadena en una operación asincrónica.Send a GET request to the specified Uri and return the response body as a string in an asynchronous operation. |
| GetType() |
Obtiene el Type de la instancia actual.Gets the Type of the current instance. (Heredado de Object) |
| MemberwiseClone() |
Crea una copia superficial del Object actual.Creates a shallow copy of the current Object. (Heredado de Object) |
| PatchAsync(String, HttpContent) |
Envía una solicitud PATCH a un URI designado como una cadena como una operación asincrónica.Sends a PATCH request to a Uri designated as a string as an asynchronous operation. |
| PatchAsync(String, HttpContent, CancellationToken) |
Envía una solicitud PATCH con un token de cancelación a un URI representado como una cadena como una operación asincrónica.Sends a PATCH request with a cancellation token to a Uri represented as a string as an asynchronous operation. |
| PatchAsync(Uri, HttpContent) |
Envía una solicitud PATCH como una operación asincrónica.Sends a PATCH request as an asynchronous operation. |
| PatchAsync(Uri, HttpContent, CancellationToken) |
Envía una solicitud PATCH con un token de cancelación como una operación asincrónica.Sends a PATCH request with a cancellation token as an asynchronous operation. |
| PostAsync(String, HttpContent) |
Envía una solicitud POST al URI especificado como una operación asincrónica.Send a POST request to the specified Uri as an asynchronous operation. |
| PostAsync(String, HttpContent, CancellationToken) |
Envía una solicitud POST con un token de cancelación como una operación asincrónica.Send a POST request with a cancellation token as an asynchronous operation. |
| PostAsync(Uri, HttpContent) |
Envía una solicitud POST al URI especificado como una operación asincrónica.Send a POST request to the specified Uri as an asynchronous operation. |
| PostAsync(Uri, HttpContent, CancellationToken) |
Envía una solicitud POST con un token de cancelación como una operación asincrónica.Send a POST request with a cancellation token as an asynchronous operation. |
| PutAsync(String, HttpContent) |
Envía una solicitud PUT al URI especificado como una operación asincrónica.Send a PUT request to the specified Uri as an asynchronous operation. |
| PutAsync(String, HttpContent, CancellationToken) |
Envía una solicitud PUT con un token de cancelación como una operación asincrónica.Send a PUT request with a cancellation token as an asynchronous operation. |
| PutAsync(Uri, HttpContent) |
Envía una solicitud PUT al URI especificado como una operación asincrónica.Send a PUT request to the specified Uri as an asynchronous operation. |
| PutAsync(Uri, HttpContent, CancellationToken) |
Envía una solicitud PUT con un token de cancelación como una operación asincrónica.Send a PUT request with a cancellation token as an asynchronous operation. |
| Send(HttpRequestMessage) |
Envía una solicitud HTTP con la solicitud especificada.Sends an HTTP request with the specified request. |
| Send(HttpRequestMessage, CancellationToken) |
Envía una solicitud HTTP con el token de cancelación y la solicitud especificados.Sends an HTTP request with the specified request and cancellation token. |
| Send(HttpRequestMessage, CancellationToken) |
Envía una solicitud HTTP con el token de cancelación y la solicitud especificados.Sends an HTTP request with the specified request and cancellation token. (Heredado de HttpMessageInvoker) |
| Send(HttpRequestMessage, HttpCompletionOption) |
Envía una solicitud HTTP.Sends an HTTP request. |
| Send(HttpRequestMessage, HttpCompletionOption, CancellationToken) |
Envía una solicitud HTTP con la solicitud, la opción de finalización y el token de cancelación especificados.Sends an HTTP request with the specified request, completion option and cancellation token. |
| SendAsync(HttpRequestMessage) |
Envía una solicitud HTTP como una operación asincrónica.Send an HTTP request as an asynchronous operation. |
| SendAsync(HttpRequestMessage, CancellationToken) |
Envía una solicitud HTTP como una operación asincrónica.Send an HTTP request as an asynchronous operation. |
| SendAsync(HttpRequestMessage, HttpCompletionOption) |
Envía una solicitud HTTP como una operación asincrónica.Send an HTTP request as an asynchronous operation. |
| SendAsync(HttpRequestMessage, HttpCompletionOption, CancellationToken) |
Envía una solicitud HTTP como una operación asincrónica.Send an HTTP request as an asynchronous operation. |
| ToString() |
Devuelve una cadena que representa el objeto actual.Returns a string that represents the current object. (Heredado de Object) |
Métodos de extensión
| GetFromJsonAsync(HttpClient, String, Type, JsonSerializerOptions, CancellationToken) |
Envía una solicitud GET al URI especificado y devuelve el valor resultante de la deserialización del cuerpo de la respuesta como JSON en una operación asincrónica.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation. |
| GetFromJsonAsync(HttpClient, String, Type, CancellationToken) |
Envía una solicitud GET al URI especificado y devuelve el valor resultante de la deserialización del cuerpo de la respuesta como JSON en una operación asincrónica.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation. |
| GetFromJsonAsync(HttpClient, Uri, Type, JsonSerializerOptions, CancellationToken) |
Envía una solicitud GET al URI especificado y devuelve el valor resultante de la deserialización del cuerpo de la respuesta como JSON en una operación asincrónica.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation. |
| GetFromJsonAsync(HttpClient, Uri, Type, CancellationToken) |
Envía una solicitud GET al URI especificado y devuelve el valor resultante de la deserialización del cuerpo de la respuesta como JSON en una operación asincrónica.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation. |
| GetFromJsonAsync<TValue>(HttpClient, String, JsonSerializerOptions, CancellationToken) |
Envía una solicitud GET al URI especificado y devuelve el valor resultante de la deserialización del cuerpo de la respuesta como JSON en una operación asincrónica.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation. |
| GetFromJsonAsync<TValue>(HttpClient, String, CancellationToken) |
Envía una solicitud GET al URI especificado y devuelve el valor resultante de la deserialización del cuerpo de la respuesta como JSON en una operación asincrónica.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation. |
| GetFromJsonAsync<TValue>(HttpClient, Uri, JsonSerializerOptions, CancellationToken) |
Envía una solicitud GET al URI especificado y devuelve el valor resultante de la deserialización del cuerpo de la respuesta como JSON en una operación asincrónica.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation. |
| GetFromJsonAsync<TValue>(HttpClient, Uri, CancellationToken) |
Envía una solicitud GET al URI especificado y devuelve el valor resultante de la deserialización del cuerpo de la respuesta como JSON en una operación asincrónica.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation. |
| PostAsJsonAsync<TValue>(HttpClient, String, TValue, JsonSerializerOptions, CancellationToken) |
Envía una solicitud POST al URI especificado que contiene el |
| PostAsJsonAsync<TValue>(HttpClient, String, TValue, CancellationToken) |
Envía una solicitud POST al URI especificado que contiene el |
| PostAsJsonAsync<TValue>(HttpClient, Uri, TValue, JsonSerializerOptions, CancellationToken) |
Envía una solicitud POST al URI especificado que contiene el |
| PostAsJsonAsync<TValue>(HttpClient, Uri, TValue, CancellationToken) |
Envía una solicitud POST al URI especificado que contiene el |
| PutAsJsonAsync<TValue>(HttpClient, String, TValue, JsonSerializerOptions, CancellationToken) |
Envía una solicitud PUT al URI especificado que contiene el |
| PutAsJsonAsync<TValue>(HttpClient, String, TValue, CancellationToken) |
Envía una solicitud PUT al URI especificado que contiene el |
| PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, JsonSerializerOptions, CancellationToken) |
Envía una solicitud PUT al URI especificado que contiene el |
| PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, CancellationToken) |
Envía una solicitud PUT al URI especificado que contiene el |