• NeonSDK
  • NeonKUBE
Search Results for

    Show / Hide Table of Contents
    • Neon
      • Build
    • Neon.Blazor
      • BlazorHelper
      • BodyOutlet
      • ClientRenderContext
      • DOMRectReadOnly
      • EventHandlers
      • FileDownloader
      • HtmlElement
      • IRenderContext
      • IntersectionChangedEventArgs
      • IntersectionObserver
      • IntersectionObserverContext
      • MobileDetector
      • NeonBlazorExtensions
      • ServerRenderContext
      • SwipeDirection
      • SwipeHandler
    • Neon.Blazor.Analyzers
      • SvgGenerator
      • SvgGenerator.Svg
    • Neon.BuildInfo
      • ThisAssembly
      • ThisAssembly.Git
      • ThisAssembly.Git.BaseVersion
      • ThisAssembly.Git.SemVer
    • Neon.CSharp
      • CSharpHelper
      • CompilerErrorException
      • MetadataReferences
    • Neon.Cassandra
      • KeyspaceStatus
      • RowSetExtensions
      • SchemaManager
      • SchemaManagerException
      • SchemaStatus
      • SessionExtensions
    • Neon.Collections
      • ArgDictionary
      • Bits
      • IObjectDictionary
      • NiceDictionary<TKey, TValue>
      • ObjectDictionary
    • Neon.Common
      • AppDomainExtensions
      • Block
      • BlockArray
      • ByteEncoding
      • ByteUnits
      • CommandLine
      • CommandLine.OptionDefinition
      • CommandLine.Redactor
      • CpuArchitecture
      • Credentials
      • DateTimeExtensions
      • EnumExtensions
      • EnvironmentParser
      • EnvironmentParser.Parser<T>
      • EnvironmentParser.Validator<T>
      • EnvironmentParser.VariableSource
      • ExceptionExtensions
      • ExecuteException
      • ExecuteResponse
      • GlobPattern
      • HexDumpOption
      • HttpClientExtensions
      • HttpResponseMessageExtensions
      • IEnumerableExtensions
      • ILabeled
      • IOExtensions
      • IServiceContainer
      • IStaticDirectoryExtensions
      • LabelSelector
      • LabelSelectorOptions
      • LabelSelector<TItem>
      • NeonAssemblyExtensions
      • NeonExtendedHelper
      • NeonHelper
      • NetFramework
      • NewtonsoftExtensions
      • NotReadyException
      • ProcessExtensions
      • ProgramEntrypoint
      • ProgramEntrypointAsync
      • ProgramExitException
      • ProgramRunner
      • RandomExtensions
      • ReflectionExtensions
      • SemanticVersion
      • ServiceContainer
      • StaticZipOptions
      • StringBuilderExtensions
      • StringExtensions
      • Stub
      • Stub.Value
      • TaskExtensions
      • TimeSpanExtensions
      • ToolException
      • TriState
      • WeakEventController
      • WindowsEdition
      • WindowsFeatureStatus
      • YamlDotNetExtensions
    • Neon.Cryptography
      • AesCipher
      • CryptoExtensions
      • CryptoHelper
      • NeonVault
      • Wildcard
    • Neon.Csv
      • CsvReader
      • CsvTableReader
      • CsvTableWriter
      • CsvWriter
    • Neon.Data
      • DateTimeJsonConverter
      • DateTimeOffsetJsonConverter
      • IEnhancedJsonConverter
      • IGeneratedServiceClient
      • IPersistableType
      • IPersistableType<T>
      • IRoundtripData
      • IntegerEnumConverter<TEnum>
      • NotifyPropertyChanged
      • RoundtripDataFactory
      • RoundtripDataHelper
      • TimeSpanJsonConverter
      • VersionJsonConverter
    • Neon.Deployment
      • AwsCli
      • DeploymentException
      • DeploymentHelper
      • DownloadManifest
      • DownloadPart
      • DownloadProgressDelegate
      • DownloadProgressType
      • GitHub
      • GitHubActionsApi
      • GitHubPackage
      • GitHubPackageApi
      • GitHubPackageType
      • GitHubPackageVersion
      • GitHubPackageVisibility
      • GitHubReleaseApi
      • GitHubRepoPath
      • GitHubTagApi
      • IProfileClient
      • IProfileRequest
      • IProfileResponse
      • MaintainerProfile
      • NotifyClient
      • OnePassword
      • OnePasswordException
      • ProfileException
      • ProfileHandlerResult
      • ProfileRequest
      • ProfileResponse
      • ProfileServer
      • ProfileStatus
      • XenServer
    • Neon.Deployment.CodeSigning
      • AzureProfile
      • CodeSigner
      • UsbTokenProfile
    • Neon.Diagnostics
      • AssertException
      • ConfigExtensions
      • ConsoleJsonLogExporter
      • ConsoleJsonLogExporterOptions
      • ConsoleTextLogExporter
      • ConsoleTextLogExporterOptions
      • ExceptionInfo
      • FileLogExporter
      • FileLogExporterFormat
      • FileLogExporterOptions
      • LogAsTraceProcessor
      • LogAsTraceProcessorOptions
      • LogAttributeNames
      • LogAttributes
      • LogEvent
      • LogEventInterceptor
      • LoggerExtensions
      • NullLogger
      • TelemetryHub
      • TelemetrySpanEventNames
      • TelemetrySpanExtensions
    • Neon.Docker
      • DockerClient
      • DockerNetwork
      • DockerNetworkContainer
      • DockerNetworkIpam
      • DockerNode
      • DockerNodeManagerStatus
      • DockerResponse
      • DockerSettings
      • DockerVolume
      • NetworkCreateResponse
      • ServiceBindOptions
      • ServiceConfig
      • ServiceContainerSpec
      • ServiceCredentialSpec
      • ServiceDetails
      • ServiceDiscreteResourceSpec
      • ServiceDnsConfig
      • ServiceEndpoint
      • ServiceEndpointMode
      • ServiceEndpointPortConfig
      • ServiceEndpointSpec
      • ServiceFile
      • ServiceGenericResources
      • ServiceGlobalSchedulingMode
      • ServiceHealthCheck
      • ServiceIsolationMode
      • ServiceListResponse
      • ServiceLogDriver
      • ServiceMode
      • ServiceMount
      • ServiceMountBindPropagation
      • ServiceMountConsistency
      • ServiceMountType
      • ServiceNamedResourceSpec
      • ServiceNetwork
      • ServicePlacement
      • ServicePlacementPreferences
      • ServicePlacementSpreadSettings
      • ServicePlatform
      • ServicePortMode
      • ServicePortProtocol
      • ServicePrivileges
      • ServiceReplicatedSchedulingMode
      • ServiceResourceSettings
      • ServiceResources
      • ServiceRestartCondition
      • ServiceRestartPolicy
      • ServiceRollbackConfig
      • ServiceRollbackFailureAction
      • ServiceRollbackOrder
      • ServiceSELinuxContext
      • ServiceSchedulingMode
      • ServiceSecret
      • ServiceSpec
      • ServiceTaskTemplate
      • ServiceTmpfsOptions
      • ServiceUpdateConfig
      • ServiceUpdateFailureAction
      • ServiceUpdateOrder
      • ServiceUpdateState
      • ServiceUpdateStatus
      • ServiceVersion
      • ServiceVirtualIP
      • ServiceVolumeDriverConfig
      • ServiceVolumeOptions
      • VolumeListResponse
    • Neon.GitHub
      • GitExtensions
      • GitHubCredentials
      • GitHubRepo
      • LocalRepoApi
      • NoLocalRepositoryException
      • RemoteRepoApi
      • RemoteRepoBranchApi
      • RemoteRepoIssueApi
      • RemoteRepoIssueCommentApi
      • RemoteRepoPath
      • RemoteRepoReleaseApi
      • RemoteRepoTagApi
    • Neon.HyperV
      • HyperVClient
      • HyperVDriverType
      • HyperVException
      • NetAdapter
      • VirtualDrive
      • VirtualIPAddress
      • VirtualMachine
      • VirtualMachineNetworkAdapter
      • VirtualMachineState
      • VirtualNat
      • VirtualSwitch
      • VirtualSwitchType
    • Neon.IO
      • BlockStream
      • FixedLengthStream
      • IStaticDirectory
      • IStaticFile
      • LineEnding
      • LinuxPath
      • LinuxPermissions
      • PreprocessReader
      • RelayStream
      • StaticDirectoryBase
      • StaticFileBase
      • SubStream
      • TempFile
      • TempFolder
    • Neon.JsonConverters
      • JsonDateTimeConverter
      • JsonGenericConverter<T>
      • JsonNullableDateTimeConverter
    • Neon.ModelGen
      • ActionResult<T>
      • ApiVersion
      • ApiVersionAttribute
      • BodyStreamAttribute
      • ControllerValidationAttribute
      • DataModelAttribute
      • EnumMember
      • FromBodyAttribute
      • FromHeaderAttribute
      • FromQueryAttribute
      • FromRouteAttribute
      • GeneratedClientAttribute
      • GeneratedMethodAttribute
      • GeneratedParamAttribute
      • HashSourceAttribute
      • HttpAttribute
      • HttpDeleteAttribute
      • HttpGetAttribute
      • HttpHeadAttribute
      • HttpOptionsAttribute
      • HttpPatchAttribute
      • HttpPostAttribute
      • HttpPutAttribute
      • IActionResult
      • ModelGenerator
      • ModelGeneratorOutput
      • ModelGeneratorSettings
      • NoCodeGenAttribute
      • NoControllerValidationAttribute
      • PassAs
      • PersistableAttribute
      • PersistableKeyAttribute
      • RouteAttribute
      • ServiceModelAttribute
      • TargetAttribute
      • UxFrameworks
    • Neon.Net
      • HttpApiException
      • HttpException
      • JsonClient
      • JsonClientPayload
      • JsonResponse
      • Jwt
      • LocalHostSection
      • NetConst
      • NetHelper
      • NetworkCidr
      • NetworkConfiguration
      • NetworkException
      • NetworkPorts
      • Pinger
      • ReachableHost
      • ReachableHostMode
      • StreamDocument
    • Neon.Postgres
      • ConnectionExtensions
      • DatabaseStatus
      • PreparedCommand
      • ReaderAsyncEnumerator
      • ReaderEnumerator
      • ReaderExtensions
      • SchemaManager
      • SchemaManagerException
      • SchemaStatus
    • Neon.Retry
      • ExponentialRetryPolicy
      • IRetryPolicy
      • LinearRetryPolicy
      • NoRetryPolicy
      • RetryPolicy
      • RetryPolicyBase
      • RetryTransientArgs
      • TransientDetector
      • TransientException
    • Neon.Roslyn
      • DisplayFormat
      • DocumentationComment
      • DocumentationItem
      • MetadataLoadContext
      • RoslynAssembly
      • RoslynConstructorInfo
      • RoslynCustomAttributeData
      • RoslynExtensions
      • RoslynFieldInfo
      • RoslynMethodInfo
      • RoslynParameterInfo
      • RoslynPropertyInfo
      • RoslynType
      • SharedUtilities
    • Neon.Roslyn.Xunit
      • AdditionalSourceText
      • CompilationOptions
      • CompilationOptionsProvider
      • TestCompilation
      • TestCompilationAssertions
      • TestCompilationBuilder
      • TestCompilationBuilderExtensions
      • TestCompilationExtensions
    • Neon.SSH
      • CommandBundle
      • CommandFile
      • CommandResponse
      • HostFolders
      • IBashCommandFormatter
      • ILinuxSshProxy
      • LinuxDiskInfo
      • LinuxDiskPartition
      • LinuxSshProxy
      • LinuxSshProxy<TMetadata>
      • NamespaceDoc
      • RemoteCommandException
      • RunOptions
      • SshCredentials
      • SshExtensions
      • SshProxyException
    • Neon.Service
      • LogMetricsProcessor
      • MetricsMode
      • MetricsOptions
      • NeonService
      • NeonServiceOptions
      • NeonServiceStatus
      • OtelConfigExtensions
      • OtlpCollectorChecker
      • ProcessTerminator
      • ServiceApiContact
      • ServiceApiInfo
      • ServiceApiLicense
      • ServiceDependencies
      • ServiceDescription
      • ServiceEndpoint
      • ServiceEndpointProtocol
      • ServiceEndpoints
      • ServiceMap
    • Neon.SignalR
      • DependencyInjectionExtensions
      • DnsCache
      • GroupAction
      • GroupCommand
      • IDnsCache
      • Invocation
      • NatsHubLifetimeManager<THub>
      • ProxyConfig
      • ServiceCollectionExtensions
      • ServiceDiscovey
      • SignalrProxyMiddleware
      • SignalrProxyMiddlewareExtensions
      • TracerProviderBuilderExtensions
    • Neon.Tailwind
      • ClickOffEventHandler
      • ComponentEventArgs<TSender>
      • ComponentEventArgs<TSender, TEventArgs>
      • DisclosureState
      • EventHandlerComponentBase<TComponent>
      • HeadlessButton
      • HeadlessDialog
      • HeadlessDialogPanel
      • HeadlessDisclosure
      • HeadlessDisclosureButton
      • HeadlessDisclosurePanel
      • HeadlessListboxButton<TValue>
      • HeadlessListboxLabel<TValue>
      • HeadlessListboxOption<TValue>
      • HeadlessListboxOptions<TValue>
      • HeadlessListbox<TValue>
      • HeadlessMenu
      • HeadlessMenuButton
      • HeadlessMenuItem
      • HeadlessMenuItems
      • HeadlessSwitch
      • HeadlessSwitchGroup
      • HeadlessSwitchLabel
      • IPortalBinder
      • KeyDownEventHandler
      • KeyboardKey
      • ListboxFocus
      • ListboxState
      • MenuFocus
      • MenuState
      • Portal
      • PortalBinder
      • PortalContent
      • SearchAssistant
      • TailwindExtensions
      • Transition
      • TransitionGroup
      • TransitionState
    • Neon.Tasks
      • Async
      • AsyncAutoResetEvent
      • AsyncManualResetEvent
      • AsyncMutex
      • AsyncPeriodicTask
      • AsyncReaderWriterLock
      • AsyncReentrantMutex
      • AsyncTimer
      • IAsyncFuture
      • IAsyncFuture<T>
      • NonDisposableTask
      • NonDisposableTask<T>
      • SyncContext
      • SyncContextMode
    • Neon.Temporal
      • ActivityHelper
      • ActivityLogEnricher
      • TemporalEnricherTagNames
      • WorkflowLogEnricher
    • Neon.Time
      • GatedTimer
      • GoDuration
      • PolledTimer
      • RecurringTimer
      • RecurringTimerType
      • SysTime
      • TimeOfDay
    • Neon.WSL
      • Wsl2Proxy
    • Neon.Web
      • AesProtector
      • DataProtectionExtensions
      • NeonController
      • NeonControllerBase
      • RoundTripJsonInputFormatter
      • RoundTripJsonOutputFormatter
      • TracerProviderBuilderExtensions
      • WebHelper
    • Neon.WinTTY
      • ConsoleTTY
    • Neon.Windows
      • MEMORYSTATUSEX
      • PowerShellException
      • Win32
    • Neon.XenServer
      • IXenClient
      • XenClient
      • XenClient.MachineOperations
      • XenClient.StorageOperations
      • XenClient.TemplateOperations
      • XenException
      • XenHostInfo
      • XenObject
      • XenResponse
      • XenStorageRepository
      • XenTempIso
      • XenTemplate
      • XenVirtualDisk
      • XenVirtualMachine
      • XenVmPowerState
    • Neon.Xunit
      • AnsiblePlayResults
      • AnsiblePlayer
      • AnsibleTaskResult
      • AspNetFixture
      • BasicFixture
      • CodeFixture
      • CollectionComparer<T>
      • ComposedFixture
      • ContainerFixture
      • ContainerLimits
      • DockerComposeFixture
      • DockerFixture
      • DockerFixture.ConfigInfo
      • DockerFixture.ContainerInfo
      • DockerFixture.NetworkInfo
      • DockerFixture.SecretInfo
      • DockerFixture.ServiceInfo
      • DockerFixture.StackDefinition
      • DockerFixture.StackInfo
      • DockerFixture.StackService
      • EnvironmentFixture
      • HostsFixture
      • ITestFixture
      • IncompatibleServiceException
      • MaintainerFactAttribute
      • MaintainerTheoryAttribute
      • MockHttpServer
      • MockHttpServerExtensions
      • NatsFixture
      • NatsStreamingFixture
      • NeonServiceFixture<TService>
      • PlatformFactAttribute
      • RepeatAttribute
      • TargetPlatforms
      • TestArea
      • TestCollection
      • TestContext
      • TestFixture
      • TestFixtureStatus
      • TestHelper
      • TestHttpClient
      • TestOutputWriter
      • TestTrait
      • XunitExtensions
    • Neon.Xunit.YugaByte
      • YugaByteFixture
    • Neon.YugaByte
      • YugaByteHelper

    Class HttpClientExtensions

    HttpClient extension methods, mostly related to easily supporting custom headers.

    Inheritance
    object
    HttpClientExtensions
    Namespace: Neon.Common
    Assembly: Neon.Common.dll
    Syntax
    public static class HttpClientExtensions

    Methods

    DeleteAsync(HttpClient, string, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a DELETE request to a string URI.

    Declaration
    public static Task<HttpResponseMessage> DeleteAsync(this HttpClient client, string requestUri, HttpContent content = null, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    DeleteAsync(HttpClient, Uri, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a DELETE request to a Uri.

    Declaration
    public static Task<HttpResponseMessage> DeleteAsync(this HttpClient client, Uri requestUri, HttpContent content = null, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    DeleteSafeAsync(HttpClient, string, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a DELETE request to a string URI ensuring that the operation succeeded.

    Declaration
    public static Task<HttpResponseMessage> DeleteSafeAsync(this HttpClient client, string requestUri, HttpContent content = null, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    DeleteSafeAsync(HttpClient, Uri, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a DELETE request to a Uri ensuring that the operation succeeded.

    Declaration
    public static Task<HttpResponseMessage> DeleteSafeAsync(this HttpClient client, Uri requestUri, HttpContent content = null, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    GetAsync(HttpClient, string, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a GET request to a specified Uri.

    Declaration
    public static Task<HttpResponseMessage> GetAsync(this HttpClient client, string requestUri, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    GetAsync(HttpClient, Uri, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a GET request to the specified string URI.

    Declaration
    public static Task<HttpResponseMessage> GetAsync(this HttpClient client, Uri requestUri, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    GetByteArrayAsync(HttpClient, string, ArgDictionary)

    Sends a GET to a specified string URI and returns the response body as a byte array.

    Declaration
    public static Task<byte[]> GetByteArrayAsync(this HttpClient client, string requestUri, ArgDictionary headers = null)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    ArgDictionary headers

    Optional request headers.

    Returns
    Type Description
    Task<byte[]>

    The response byte array.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    GetByteArrayAsync(HttpClient, Uri, ArgDictionary)

    Sends a GET to a specified Uri and returns the response body as a byte array.

    Declaration
    public static Task<byte[]> GetByteArrayAsync(this HttpClient client, Uri requestUri, ArgDictionary headers = null)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    ArgDictionary headers

    Optional request headers.

    Returns
    Type Description
    Task<byte[]>

    The response byte array.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    GetByteArraySafeAsync(HttpClient, string, ArgDictionary)

    Sends a GET to a specified string URI and returns the response body as a byte array ensuring that the operation succeeded.

    Declaration
    public static Task<byte[]> GetByteArraySafeAsync(this HttpClient client, string requestUri, ArgDictionary headers = null)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    ArgDictionary headers

    Optional request headers.

    Returns
    Type Description
    Task<byte[]>

    The response byte array.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    GetByteArraySafeAsync(HttpClient, Uri, ArgDictionary)

    Sends a GET to a specified Uri and returns the response body as a byte array ensuring that the operation succeeded.

    Declaration
    public static Task<byte[]> GetByteArraySafeAsync(this HttpClient client, Uri requestUri, ArgDictionary headers = null)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    ArgDictionary headers

    Optional request headers.

    Returns
    Type Description
    Task<byte[]>

    The response byte array.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    GetSafeAsync(HttpClient, string, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a GET request to a specified Uri ensuring that the operation succeeded.

    Declaration
    public static Task<HttpResponseMessage> GetSafeAsync(this HttpClient client, string requestUri, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    GetSafeAsync(HttpClient, Uri, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a GET request to the specified string URI ensuring that the operation succeeded.

    Declaration
    public static Task<HttpResponseMessage> GetSafeAsync(this HttpClient client, Uri requestUri, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    GetStreamAsync(HttpClient, string, ArgDictionary)

    Sends a GET to a specified string URI and returns the response body as a Stream.

    Declaration
    public static Task<Stream> GetStreamAsync(this HttpClient client, string requestUri, ArgDictionary headers = null)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    ArgDictionary headers

    Optional request headers.

    Returns
    Type Description
    Task<Stream>

    The response stream.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    GetStreamAsync(HttpClient, Uri, ArgDictionary)

    Sends a GET to a specified Uri and returns the response body as a Stream.

    Declaration
    public static Task<Stream> GetStreamAsync(this HttpClient client, Uri requestUri, ArgDictionary headers = null)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    ArgDictionary headers

    Optional request headers.

    Returns
    Type Description
    Task<Stream>

    The response stream.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    GetStreamSafeAsync(HttpClient, string, ArgDictionary)

    Sends a GET to a specified string URI and returns the response body as a Stream ensuring that the operation succeeded.

    Declaration
    public static Task<Stream> GetStreamSafeAsync(this HttpClient client, string requestUri, ArgDictionary headers = null)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    ArgDictionary headers

    Optional request headers.

    Returns
    Type Description
    Task<Stream>

    The response stream.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    GetStreamSafeAsync(HttpClient, Uri, ArgDictionary)

    Sends a GET to a specified Uri and returns the response body as a Stream ensuring that the operation succeeded.

    Declaration
    public static Task<Stream> GetStreamSafeAsync(this HttpClient client, Uri requestUri, ArgDictionary headers = null)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    ArgDictionary headers

    Optional request headers.

    Returns
    Type Description
    Task<Stream>

    The response stream.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    GetStringAsync(HttpClient, string, ArgDictionary)

    Sends a GET request to a string URI and returns the response as a string.

    Declaration
    public static Task<string> GetStringAsync(this HttpClient client, string requestUri, ArgDictionary headers = null)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    ArgDictionary headers

    Optional request headers.

    Returns
    Type Description
    Task<string>

    The response string.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    GetStringAsync(HttpClient, Uri, ArgDictionary)

    Sends a GET request to a Uri and returns the response as a string.

    Declaration
    public static Task<string> GetStringAsync(this HttpClient client, Uri requestUri, ArgDictionary headers = null)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    ArgDictionary headers

    Optional request headers.

    Returns
    Type Description
    Task<string>

    The response string.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    GetStringSafeAsync(HttpClient, string, ArgDictionary)

    Sends a GET request to a string URI and returns the response as a string ensuring that the operation succeeded.

    Declaration
    public static Task<string> GetStringSafeAsync(this HttpClient client, string requestUri, ArgDictionary headers = null)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    ArgDictionary headers

    Optional request headers.

    Returns
    Type Description
    Task<string>

    The response string.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    GetStringSafeAsync(HttpClient, Uri, ArgDictionary)

    Sends a GET request to a Uri and returns the response as a string ensuring that the operation succeeded.

    Declaration
    public static Task<string> GetStringSafeAsync(this HttpClient client, Uri requestUri, ArgDictionary headers = null)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    ArgDictionary headers

    Optional request headers.

    Returns
    Type Description
    Task<string>

    The response string.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    GetToFileSafeAsync(HttpClient, string, string, ArgDictionary)

    Downloads the contents of a string URI to a file.

    Declaration
    public static Task<HttpResponseMessage> GetToFileSafeAsync(this HttpClient client, string requestUri, string outputPath, ArgDictionary headers = null)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    string outputPath

    The path to the output file.

    ArgDictionary headers

    Optional request headers.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The HttpResponseMessage making things like response headers available.

    GetToFileSafeAsync(HttpClient, Uri, string, ArgDictionary)

    Downloads the contents of a string URI to a file.

    Declaration
    public static Task<HttpResponseMessage> GetToFileSafeAsync(this HttpClient client, Uri requestUri, string outputPath, ArgDictionary headers = null)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    string outputPath

    The path to the output file.

    ArgDictionary headers

    Optional request headers.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The HttpResponseMessage making things like response headers available.

    GetToStreamSafeAsync(HttpClient, string, Stream, ArgDictionary)

    Downloads the contents of a string URI to a stream.

    Declaration
    public static Task<HttpResponseMessage> GetToStreamSafeAsync(this HttpClient client, string requestUri, Stream output, ArgDictionary headers = null)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    Stream output

    The stream where the URI contents will be written.

    ArgDictionary headers

    Optional request headers.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The HttpResponseMessage making things like response headers available.

    GetToStreamSafeAsync(HttpClient, Uri, Stream, ArgDictionary)

    Downloads the contents of a URI to a stream.

    Declaration
    public static Task<HttpResponseMessage> GetToStreamSafeAsync(this HttpClient client, Uri requestUri, Stream output, ArgDictionary headers = null)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    Stream output

    The stream where the URI contents will be written.

    ArgDictionary headers

    Optional request headers.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The HttpResponseMessage making things like response headers available.

    HeadAsync(HttpClient, string, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a HEAD request to a string URI.

    Declaration
    public static Task<HttpResponseMessage> HeadAsync(this HttpClient client, string requestUri, HttpContent content = null, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    HeadAsync(HttpClient, Uri, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a HEAD request to a Uri.

    Declaration
    public static Task<HttpResponseMessage> HeadAsync(this HttpClient client, Uri requestUri, HttpContent content = null, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    HeadSafeAsync(HttpClient, string, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a HEAD request to a string URI ensuring that the operation succeeded.

    Declaration
    public static Task<HttpResponseMessage> HeadSafeAsync(this HttpClient client, string requestUri, HttpContent content = null, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    HeadSafeAsync(HttpClient, Uri, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a HEAD request to a Uri ensuring that the operation succeeded.

    Declaration
    public static Task<HttpResponseMessage> HeadSafeAsync(this HttpClient client, Uri requestUri, HttpContent content = null, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    OptionsAsync(HttpClient, string, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a OPTIONS request to a string URI.

    Declaration
    public static Task<HttpResponseMessage> OptionsAsync(this HttpClient client, string requestUri, HttpContent content = null, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    OptionsAsync(HttpClient, Uri, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a OPTIONS request to a Uri.

    Declaration
    public static Task<HttpResponseMessage> OptionsAsync(this HttpClient client, Uri requestUri, HttpContent content = null, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    OptionsSafeAsync(HttpClient, string, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a OPTIONS request to a string URI ensuring that the operation succeeded.

    Declaration
    public static Task<HttpResponseMessage> OptionsSafeAsync(this HttpClient client, string requestUri, HttpContent content = null, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    OptionsSafeAsync(HttpClient, Uri, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a OPTIONS request to a Uri ensuring that the operation succeeded.

    Declaration
    public static Task<HttpResponseMessage> OptionsSafeAsync(this HttpClient client, Uri requestUri, HttpContent content = null, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    PatchAsync(HttpClient, string, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a PATCH request to a string URI.

    Declaration
    public static Task<HttpResponseMessage> PatchAsync(this HttpClient client, string requestUri, HttpContent content, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    PatchAsync(HttpClient, Uri, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a PATCH request to a Uri.

    Declaration
    public static Task<HttpResponseMessage> PatchAsync(this HttpClient client, Uri requestUri, HttpContent content, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    PatchSafeAsync(HttpClient, string, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a PATCH request to a string URI ensuring that the operation succeeded.

    Declaration
    public static Task<HttpResponseMessage> PatchSafeAsync(this HttpClient client, string requestUri, HttpContent content, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    PatchSafeAsync(HttpClient, Uri, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a PATCH request to a Uri ensuring that the operation succeeded.

    Declaration
    public static Task<HttpResponseMessage> PatchSafeAsync(this HttpClient client, Uri requestUri, HttpContent content, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    PostAsync(HttpClient, string, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a POST request to a string URI.

    Declaration
    public static Task<HttpResponseMessage> PostAsync(this HttpClient client, string requestUri, HttpContent content, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    PostAsync(HttpClient, Uri, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a POST request to a Uri.

    Declaration
    public static Task<HttpResponseMessage> PostAsync(this HttpClient client, Uri requestUri, HttpContent content, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    PostSafeAsync(HttpClient, string, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a POST request to a string URI ensuring that the operation succeeded.

    Declaration
    public static Task<HttpResponseMessage> PostSafeAsync(this HttpClient client, string requestUri, HttpContent content, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    PostSafeAsync(HttpClient, Uri, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a POST request to a Uri ensuring that the operation succeeded.

    Declaration
    public static Task<HttpResponseMessage> PostSafeAsync(this HttpClient client, Uri requestUri, HttpContent content, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    PutAsync(HttpClient, string, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a PUT request to a string URI.

    Declaration
    public static Task<HttpResponseMessage> PutAsync(this HttpClient client, string requestUri, HttpContent content, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    PutAsync(HttpClient, Uri, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a PUT request to a Uri.

    Declaration
    public static Task<HttpResponseMessage> PutAsync(this HttpClient client, Uri requestUri, HttpContent content, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    PutSafeAsync(HttpClient, string, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a PUT request to a string URI ensuring that the operation succeeded.

    Declaration
    public static Task<HttpResponseMessage> PutSafeAsync(this HttpClient client, string requestUri, HttpContent content, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    string requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    PutSafeAsync(HttpClient, Uri, HttpContent, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends a PUT request to a Uri ensuring that the operation succeeded.

    Declaration
    public static Task<HttpResponseMessage> PutSafeAsync(this HttpClient client, Uri requestUri, HttpContent content, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    Uri requestUri

    The request URI.

    HttpContent content

    The content to be sent to the server.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    SendAsync(HttpClient, HttpRequestMessage, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends an HttpRequestMessage.

    Declaration
    public static Task<HttpResponseMessage> SendAsync(this HttpClient client, HttpRequestMessage request, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    HttpRequestMessage request

    The request.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    InvalidOperationException

    Thrown when the request has already been sent by the HttpClient class.

    SendSafeAsync(HttpClient, HttpRequestMessage, ArgDictionary, HttpCompletionOption, CancellationToken)

    Sends an HttpRequestMessage ensuring that the operation succeeded.

    Declaration
    public static Task<HttpResponseMessage> SendSafeAsync(this HttpClient client, HttpRequestMessage request, ArgDictionary headers = null, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    HttpClient client

    The client.

    HttpRequestMessage request

    The request.

    ArgDictionary headers

    Optional request headers.

    HttpCompletionOption completionOption

    Optionally specifies when the operation should complete (as soon as a response is available or after reading the whole response content).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<HttpResponseMessage>

    The response.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when a required argument is null.

    InvalidOperationException

    Thrown when the request has already been sent by the HttpClient class.

    SocketException

    Thrown for network connectivity issues.

    HttpException

    Thrown when the server responds with an HTTP error status code.

    In this article
    Back to top © Copyright 2005-2023 by NEONFORGE LLC