# Table of Contents
- [Alamofire Reference](#alamofire-reference)
- [Adapter Class Reference](#adapter-class-reference)
- [AlamofireNotifications Class Reference](#alamofirenotifications-class-reference)
- [Alamofire Reference](#alamofire-reference)
- [Classes Reference](#classes-reference)
- [AuthenticationInterceptor Class Reference](#authenticationinterceptor-class-reference)
- [RefreshWindow Structure Reference](#refreshwindow-structure-reference)
- [CompositeTrustEvaluator Class Reference](#compositetrustevaluator-class-reference)
- [ClosureEventMonitor Class Reference](#closureeventmonitor-class-reference)
- [ConnectionLostRetryPolicy Class Reference](#connectionlostretrypolicy-class-reference)
- [DataResponseSerializer Class Reference](#dataresponseserializer-class-reference)
- [CompositeEventMonitor Class Reference](#compositeeventmonitor-class-reference)
- [Stream Structure Reference](#stream-structure-reference)
- [DataStreamRequest Class Reference](#datastreamrequest-class-reference)
- [Completion Structure Reference](#completion-structure-reference)
- [Event Enumeration Reference](#event-enumeration-reference)
- [CancellationToken Structure Reference](#cancellationtoken-structure-reference)
- [DataRequest Class Reference](#datarequest-class-reference)
- [DecodableResponseSerializer Class Reference](#decodableresponseserializer-class-reference)
- [DefaultTrustEvaluator Class Reference](#defaulttrustevaluator-class-reference)
- [DisabledTrustEvaluator Class Reference](#disabledtrustevaluator-class-reference)
- [Options Structure Reference](#options-structure-reference)
- [DownloadRequest Class Reference](#downloadrequest-class-reference)
- [JSONParameterEncoder Class Reference](#jsonparameterencoder-class-reference)
- [Downloadable Enumeration Reference](#downloadable-enumeration-reference)
- [Interceptor Class Reference](#interceptor-class-reference)
- [JSONResponseSerializer Class Reference](#jsonresponseserializer-class-reference)
- [MultipartFormData Class Reference](#multipartformdata-class-reference)
- [PinnedCertificatesTrustEvaluator Class Reference](#pinnedcertificatestrustevaluator-class-reference)
- [NetworkReachabilityManager Class Reference](#networkreachabilitymanager-class-reference)
- [NetworkReachabilityStatus Enumeration Reference](#networkreachabilitystatus-enumeration-reference)
- [PublicKeysTrustEvaluator Class Reference](#publickeystrustevaluator-class-reference)
- [Retrier Class Reference](#retrier-class-reference)
- [RetryPolicy Class Reference](#retrypolicy-class-reference)
- [RevocationTrustEvaluator Class Reference](#revocationtrustevaluator-class-reference)
- [Options Structure Reference](#options-structure-reference)
- [ServerTrustManager Class Reference](#servertrustmanager-class-reference)
- [SessionDelegate Class Reference](#sessiondelegate-class-reference)
- [Request Class Reference](#request-class-reference)
- [State Enumeration Reference](#state-enumeration-reference)
- [ResponseDisposition Enumeration Reference](#responsedisposition-enumeration-reference)
- [StringResponseSerializer Class Reference](#stringresponseserializer-class-reference)
- [Session Class Reference](#session-class-reference)
- [BoolEncoding Enumeration Reference](#boolencoding-enumeration-reference)
- [DataEncoding Enumeration Reference](#dataencoding-enumeration-reference)
- [URLEncodedFormEncoder Class Reference](#urlencodedformencoder-class-reference)
- [ArrayEncoding Enumeration Reference](#arrayencoding-enumeration-reference)
- [DateEncoding Enumeration Reference](#dateencoding-enumeration-reference)
- [NilEncoding Structure Reference](#nilencoding-structure-reference)
- [KeyEncoding Enumeration Reference](#keyencoding-enumeration-reference)
- [Error Enumeration Reference](#error-enumeration-reference)
- [Destination Enumeration Reference](#destination-enumeration-reference)
- [KeyPathEncoding Structure Reference](#keypathencoding-structure-reference)
- [Global Variables Reference](#global-variables-reference)
- [SpaceEncoding Enumeration Reference](#spaceencoding-enumeration-reference)
- [UploadRequest Class Reference](#uploadrequest-class-reference)
- [URLEncodedFormParameterEncoder Class Reference](#urlencodedformparameterencoder-class-reference)
- [Enumerations Reference](#enumerations-reference)
- [Uploadable Enumeration Reference](#uploadable-enumeration-reference)
- [MultipartEncodingFailureReason Enumeration Reference](#multipartencodingfailurereason-enumeration-reference)
- [UnexpectedInputStreamLength Structure Reference](#unexpectedinputstreamlength-structure-reference)
- [ParameterEncoderFailureReason Enumeration Reference](#parameterencoderfailurereason-enumeration-reference)
- [AFError Enumeration Reference](#aferror-enumeration-reference)
- [ParameterEncodingFailureReason Enumeration Reference](#parameterencodingfailurereason-enumeration-reference)
- [ResponseValidationFailureReason Enumeration Reference](#responsevalidationfailurereason-enumeration-reference)
- [ServerTrustFailureReason Enumeration Reference](#servertrustfailurereason-enumeration-reference)
- [AFInfo Enumeration Reference](#afinfo-enumeration-reference)
- [URLRequestValidationFailureReason Enumeration Reference](#urlrequestvalidationfailurereason-enumeration-reference)
- [RetryResult Enumeration Reference](#retryresult-enumeration-reference)
- [ResponseSerializationFailureReason Enumeration Reference](#responseserializationfailurereason-enumeration-reference)
- [CharacterSet Extension Reference](#characterset-extension-reference)
- [AuthenticationError Enumeration Reference](#authenticationerror-enumeration-reference)
- [Error Extension Reference](#error-extension-reference)
- [Extensions Reference](#extensions-reference)
- [URLComponents Extension Reference](#urlcomponents-extension-reference)
- [Notification Extension Reference](#notification-extension-reference)
- [URL Extension Reference](#url-extension-reference)
- [HTTPURLResponse Extension Reference](#httpurlresponse-extension-reference)
- [String Extension Reference](#string-extension-reference)
- [URLSessionConfiguration Extension Reference](#urlsessionconfiguration-extension-reference)
- [URLRequest Extension Reference](#urlrequest-extension-reference)
- [[ServerTrustEvaluating] Extension Reference](#-servertrustevaluating-extension-reference)
- [Protocols Reference](#protocols-reference)
- [CachedResponseHandler Protocol Reference](#cachedresponsehandler-protocol-reference)
- [Authenticator Protocol Reference](#authenticator-protocol-reference)
- [AlamofireExtended Protocol Reference](#alamofireextended-protocol-reference)
- [AuthenticationCredential Protocol Reference](#authenticationcredential-protocol-reference)
- [DataDecoder Protocol Reference](#datadecoder-protocol-reference)
- [DataPreprocessor Protocol Reference](#datapreprocessor-protocol-reference)
- [DataResponseSerializerProtocol Protocol Reference](#dataresponseserializerprotocol-protocol-reference)
- [DownloadResponseSerializerProtocol Protocol Reference](#downloadresponseserializerprotocol-protocol-reference)
- [ParameterEncoder Protocol Reference](#parameterencoder-protocol-reference)
- [DataStreamSerializer Protocol Reference](#datastreamserializer-protocol-reference)
- [ParameterEncoding Protocol Reference](#parameterencoding-protocol-reference)
- [EmptyResponse Protocol Reference](#emptyresponse-protocol-reference)
- [EventMonitor Protocol Reference](#eventmonitor-protocol-reference)
- [RedirectHandler Protocol Reference](#redirecthandler-protocol-reference)
- [RequestRetrier Protocol Reference](#requestretrier-protocol-reference)
- [RequestAdapter Protocol Reference](#requestadapter-protocol-reference)
- [URLConvertible Protocol Reference](#urlconvertible-protocol-reference)
- [ResponseSerializer Protocol Reference](#responseserializer-protocol-reference)
- [URLRequestConvertible Protocol Reference](#urlrequestconvertible-protocol-reference)
- [RequestDelegate Protocol Reference](#requestdelegate-protocol-reference)
- [UploadableConvertible Protocol Reference](#uploadableconvertible-protocol-reference)
- [ServerTrustEvaluating Protocol Reference](#servertrustevaluating-protocol-reference)
- [RequestInterceptor Protocol Reference](#requestinterceptor-protocol-reference)
- [Structures Reference](#structures-reference)
- [WebSocketMessageSerializer Protocol Reference](#websocketmessageserializer-protocol-reference)
- [DataResponse Structure Reference](#dataresponse-structure-reference)
- [AlamofireExtension Structure Reference](#alamofireextension-structure-reference)
- [DataResponsePublisher Structure Reference](#dataresponsepublisher-structure-reference)
- [DataStreamPublisher Structure Reference](#datastreampublisher-structure-reference)
- [DataStreamTask Structure Reference](#datastreamtask-structure-reference)
- [DataTask Structure Reference](#datatask-structure-reference)
- [DecodableStreamSerializer Structure Reference](#decodablestreamserializer-structure-reference)
- [DeflateRequestCompressor Structure Reference](#deflaterequestcompressor-structure-reference)
- [DecodableWebSocketMessageDecoder Structure Reference](#decodablewebsocketmessagedecoder-structure-reference)
- [DuplicateHeaderBehavior Enumeration Reference](#duplicateheaderbehavior-enumeration-reference)
- [Error Enumeration Reference](#error-enumeration-reference)
- [Empty Structure Reference](#empty-structure-reference)
- [DownloadTask Structure Reference](#downloadtask-structure-reference)
- [DownloadResponse Structure Reference](#downloadresponse-structure-reference)
- [DownloadResponsePublisher Structure Reference](#downloadresponsepublisher-structure-reference)
- [GoogleXSSIPreprocessor Structure Reference](#googlexssipreprocessor-structure-reference)
- [HTTPHeaders Structure Reference](#httpheaders-structure-reference)
- [HTTPMethod Structure Reference](#httpmethod-structure-reference)
- [HTTPHeader Structure Reference](#httpheader-structure-reference)
- [JSONEncoding Structure Reference](#jsonencoding-structure-reference)
- [Error Enumeration Reference](#error-enumeration-reference)
- [PassthroughPreprocessor Structure Reference](#passthroughpreprocessor-structure-reference)
- [PassthroughStreamSerializer Structure Reference](#passthroughstreamserializer-structure-reference)
- [RequestAdapterState Structure Reference](#requestadapterstate-structure-reference)
- [Behavior Enumeration Reference](#behavior-enumeration-reference)
- [ResponseCacher Structure Reference](#responsecacher-structure-reference)
---
# Alamofire Reference

[](https://img.shields.io/badge/Swift-5.9_5.10_6.0-Orange?style=flat-square)
[](https://img.shields.io/badge/Platforms-macOS_iOS_tvOS_watchOS_vision_OS_Linux_Windows_Android-Green?style=flat-square)
[](https://img.shields.io/cocoapods/v/Alamofire.svg)
[](https://github.com/Carthage/Carthage)
[](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square)
[](https://forums.swift.org/c/related-projects/alamofire/37)
Alamofire is an HTTP networking library written in Swift.
* [Features](#features)
* [Component Libraries](#component-libraries)
* [Requirements](#requirements)
* [Migration Guides](#migration-guides)
* [Communication](#communication)
* [Installation](#installation)
* [Contributing](#contributing)
* [Usage](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#using-alamofire)
* [**Introduction -**](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#introduction)
[Making Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#making-requests)
, [Response Handling](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-handling)
, [Response Validation](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-validation)
, [Response Caching](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-caching)
* **HTTP -** [HTTP Methods](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#http-methods)
, [Parameters and Parameter Encoder](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md##request-parameters-and-parameter-encoders)
, [HTTP Headers](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#http-headers)
, [Authentication](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#authentication)
* **Large Data -** [Downloading Data to a File](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#downloading-data-to-a-file)
, [Uploading Data to a Server](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#uploading-data-to-a-server)
* **Tools -** [Statistical Metrics](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#statistical-metrics)
, [cURL Command Output](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#curl-command-output)
* [Advanced Usage](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md)
* **URL Session -** [Session Manager](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#session)
, [Session Delegate](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#sessiondelegate)
, [Request](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#request)
* **Routing -** [Routing Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#routing-requests)
, [Adapting and Retrying Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#adapting-and-retrying-requests-with-requestinterceptor)
* **Model Objects -** [Custom Response Handlers](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#customizing-response-handlers)
* **Advanced Concurrency -** [Swift Concurrency](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#using-alamofire-with-swift-concurrency)
and [Combine](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#using-alamofire-with-combine)
* **Connection -** [Security](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#security)
, [Network Reachability](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#network-reachability)
* [Open Radars](#open-radars)
* [FAQ](#faq)
* [Credits](#credits)
* [Donations](#donations)
* [License](#license)
Features
--------
* \[x\] Chainable Request / Response Methods
* \[x\] Swift Concurrency Support Back to iOS 13, macOS 10.15, tvOS 13, and watchOS 6.
* \[x\] Combine Support
* \[x\] URL / JSON Parameter Encoding
* \[x\] Upload File / Data / Stream / MultipartFormData
* \[x\] Download File using Request or Resume Data
* \[x\] Authentication with `URLCredential`
* \[x\] HTTP Response Validation
* \[x\] Upload and Download Progress Closures with Progress
* \[x\] cURL Command Output
* \[x\] Dynamically Adapt and Retry Requests
* \[x\] TLS Certificate and Public Key Pinning
* \[x\] Network Reachability
* \[x\] Comprehensive Unit and Integration Test Coverage
* \[x\] [Complete Documentation](https://alamofire.github.io/Alamofire)
Write Requests Fast!
--------------------
Alamofire’s compact syntax and extensive feature set allow requests with powerful features like automatic retry to be written in just a few lines of code.
// Automatic String to URL conversion, Swift concurrency support, and automatic retry.
let response = await AF.request("https://httpbin.org/get", interceptor: .retryPolicy)
// Automatic HTTP Basic Auth.
.authenticate(username: "user", password: "pass")
// Caching customization.
.cacheResponse(using: .cache)
// Redirect customization.
.redirect(using: .follow)
// Validate response code and Content-Type.
.validate()
// Produce a cURL command for the request.
.cURLDescription { description in
print(description)
}
// Automatic Decodable support with background parsing.
.serializingDecodable(DecodableType.self)
// Await the full response with metrics and a parsed body.
.response
// Detailed response description for easy debugging.
debugPrint(response)
Component Libraries
-------------------
In order to keep Alamofire focused specifically on core networking implementations, additional component libraries have been created by the [Alamofire Software Foundation](https://github.com/Alamofire/Foundation)
to bring additional functionality to the Alamofire ecosystem.
* [AlamofireImage](https://github.com/Alamofire/AlamofireImage)
- An image library including image response serializers, `UIImage` and `UIImageView` extensions, custom image filters, an auto-purging in-memory cache, and a priority-based image downloading system.
* [AlamofireNetworkActivityIndicator](https://github.com/Alamofire/AlamofireNetworkActivityIndicator)
- Controls the visibility of the network activity indicator on iOS using Alamofire. It contains configurable delay timers to help mitigate flicker and can support `URLSession` instances not managed by Alamofire.
Requirements
------------
| Platform | Minimum Swift Version | Installation | Status |
| --- | --- | --- | --- |
| iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+ | 5.9 / Xcode 15.0 | [CocoaPods](#cocoapods)
, [Carthage](#carthage)
, [Swift Package Manager](#swift-package-manager)
, [Manual](#manually) | Fully Tested |
| Linux | Latest Only | [Swift Package Manager](#swift-package-manager) | Building But Unsupported |
| Windows | Latest Only | [Swift Package Manager](#swift-package-manager) | Building But Unsupported |
| Android | Latest Only | [Swift Package Manager](#swift-package-manager) | Building But Unsupported |
#### Known Issues on Linux and Windows
Alamofire builds on Linux, Windows, and Android but there are missing features and many issues in the underlying `swift-corelibs-foundation` that prevent full functionality and may cause crashes. These include:
* `[ServerTrustManager](Classes/ServerTrustManager.html) ` and associated certificate functionality is unavailable, so there is no certificate pinning and no client certificate support.
* Various methods of HTTP authentication may crash, including HTTP Basic and HTTP Digest. Crashes may occur if responses contain server challenges.
* Cache control through `[CachedResponseHandler](Protocols/CachedResponseHandler.html) ` and associated APIs is unavailable, as the underlying delegate methods aren’t called.
* `URLSessionTaskMetrics` are never gathered.
* `WebSocketRequest` is not available.
Due to these issues, Alamofire is unsupported on Linux, Windows, and Android. Please report any crashes to the [Swift bug reporter](https://bugs.swift.org)
.
Migration Guides
----------------
* [Alamofire 5.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%205.0%20Migration%20Guide.md)
* [Alamofire 4.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%204.0%20Migration%20Guide.md)
* [Alamofire 3.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%203.0%20Migration%20Guide.md)
* [Alamofire 2.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%202.0%20Migration%20Guide.md)
Communication
-------------
* If you **need help with making network requests** using Alamofire, use [Stack Overflow](https://stackoverflow.com/questions/tagged/alamofire)
and tag `alamofire`.
* If you need to **find or understand an API**, check [our documentation](http://alamofire.github.io/Alamofire/)
or [Apple’s documentation for `URLSession`](https://developer.apple.com/documentation/foundation/url_loading_system)
, on top of which Alamofire is built.
* If you need **help with an Alamofire feature**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire)
.
* If you’d like to **discuss Alamofire best practices**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire)
.
* If you’d like to **discuss a feature request**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire)
.
* If you **found a bug**, open an issue here on GitHub and follow the guide. The more detail the better!
Installation
------------
### Swift Package Manager
The [Swift Package Manager](https://swift.org/package-manager/)
is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler.
Once you have your Swift package set up, adding Alamofire as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift` or the Package list in Xcode.
dependencies: [\
.package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.10.0"))\
]
Normally you’ll want to depend on the `Alamofire` target:
.product(name: "Alamofire", package: "Alamofire")
But if you want to force Alamofire to be dynamically linked (do not do this unless you’re sure you need it), you can depend on the `AlamofireDynamic` target:
.product(name: "AlamofireDynamic", package: "Alamofire")
### CocoaPods
[CocoaPods](https://cocoapods.org)
is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Alamofire into your Xcode project using CocoaPods, specify it in your `Podfile`:
pod 'Alamofire'
### Carthage
[Carthage](https://github.com/Carthage/Carthage)
is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate Alamofire into your Xcode project using Carthage, specify it in your `Cartfile`:
github "Alamofire/Alamofire"
### Manually
If you prefer not to use any of the aforementioned dependency managers, you can integrate Alamofire into your project manually.
#### Embedded Framework
* Open up Terminal, `cd` into your top-level project directory, and run the following command “if” your project is not initialized as a git repository:
$ git init
* Add Alamofire as a git [submodule](https://git-scm.com/docs/git-submodule)
by running the following command:
$ git submodule add https://github.com/Alamofire/Alamofire.git
* Open the new `Alamofire` folder, and drag the `Alamofire.xcodeproj` into the Project Navigator of your application’s Xcode project.
> It should appear nested underneath your application’s blue project icon. Whether it is above or below all the other Xcode groups does not matter.
* Select the `Alamofire.xcodeproj` in the Project Navigator and verify the deployment target matches that of your application target.
* Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the “Targets” heading in the sidebar.
* In the tab bar at the top of that window, open the “General” panel.
* Click on the `+` button under the “Embedded Binaries” section.
* You will see two different `Alamofire.xcodeproj` folders each with two different versions of the `Alamofire.framework` nested inside a `Products` folder.
> It does not matter which `Products` folder you choose from, but it does matter whether you choose the top or bottom `Alamofire.framework`.
* Select the top `Alamofire.framework` for iOS and the bottom one for macOS.
> You can verify which one you selected by inspecting the build log for your project. The build target for `Alamofire` will be listed as `Alamofire iOS`, `Alamofire macOS`, `Alamofire tvOS`, or `Alamofire watchOS`.
* And that’s it!
> The `Alamofire.framework` is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device.
Contributing
------------
Before contributing to Alamofire, please read the instructions detailed in our [contribution guide](https://github.com/Alamofire/Alamofire/blob/master/CONTRIBUTING.md)
.
Open Radars
-----------
The following radars have some effect on the current implementation of Alamofire.
* [`rdar://21349340`](http://www.openradar.me/radar?id=5517037090635776)
- Compiler throwing warning due to toll-free bridging issue in the test case
* `rdar://26870455` - Background URL Session Configurations do not work in the simulator
* `rdar://26849668` - Some URLProtocol APIs do not properly handle `URLRequest`
Resolved Radars
---------------
The following radars have been resolved over time after being filed against the Alamofire project.
* [`rdar://26761490`](http://www.openradar.me/radar?id=5010235949318144)
- Swift string interpolation causing memory leak with common usage.
* (Resolved): 9/1/17 in Xcode 9 beta 6.
* [`rdar://36082113`](http://openradar.appspot.com/radar?id=4942308441063424)
- `URLSessionTaskMetrics` failing to link on watchOS 3.0+
* (Resolved): Just add `CFNetwork` to your linked frameworks.
* `FB7624529` - `urlSession(_:task:didFinishCollecting:)` never called on watchOS
* (Resolved): Metrics now collected on watchOS 7+.
FAQ
---
### What’s the origin of the name Alamofire?
Alamofire is named after the [Alamo Fire flower](https://aggie-horticulture.tamu.edu/wildseed/alamofire.html)
, a hybrid variant of the Bluebonnet, the official state flower of Texas.
Credits
-------
Alamofire is owned and maintained by the [Alamofire Software Foundation](http://alamofire.org)
. You can follow them on Twitter at [@AlamofireSF](https://twitter.com/AlamofireSF)
for project updates and releases.
### Security Disclosure
If you believe you have identified a security vulnerability with Alamofire, you should report it as soon as possible via email to [security@alamofire.org](mailto:security@alamofire.org)
. Please do not post it to a public issue tracker.
Sponsorship
-----------
The [ASF](https://github.com/Alamofire/Foundation#members)
is looking to raise money to officially stay registered as a federal non-profit organization. Registering will allow Foundation members to gain some legal protections and also allow us to put donations to use, tax-free. Sponsoring the ASF will enable us to:
* Pay our yearly legal fees to keep the non-profit in good status
* Pay for our mail servers to help us stay on top of all questions and security issues
* Potentially fund test servers to make it easier for us to test the edge cases
* Potentially fund developers to work on one of our projects full-time
The community adoption of the ASF libraries has been amazing. We are greatly humbled by your enthusiasm around the projects and want to continue to do everything we can to move the needle forward. With your continued support, the ASF will be able to improve its reach and also provide better legal safety for the core members. If you use any of our libraries for work, see if your employers would be interested in donating. Any amount you can donate, whether once or monthly, to help us reach our goal would be greatly appreciated.
[Sponsor Alamofire](https://github.com/sponsors/Alamofire)
Supporters
----------
[MacStadium](https://macstadium.com)
provides Alamofire with a free, hosted Mac mini.

License
-------
Alamofire is released under the MIT license. [See LICENSE](https://github.com/Alamofire/Alamofire/blob/master/LICENSE)
for details.
---
# Adapter Class Reference
Adapter
=======
Closure-based `[RequestAdapter](../Protocols/RequestAdapter.html) `.
* `[init(_:)](#/s:9Alamofire7AdapterCyACy10Foundation10URLRequestV_AA7SessionCys6ResultOyAFs5Error_pGctccfc) `
Creates an instance using the provided closure.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_adaptHandler_` | `[AdaptHandler](../Typealiases.html#/s:9Alamofire12AdaptHandlera) ` closure to be executed when handling request adaptation. |
* `[adapt(_:for:completion:)](#/s:9Alamofire14RequestAdapterP5adapt_3for10completiony10Foundation10URLRequestV_AA7SessionCys6ResultOyAIs5Error_pGYbctF) `
#### Declaration
* `[adapt(_:using:completion:)](#/s:9Alamofire14RequestAdapterP5adapt_5using10completiony10Foundation10URLRequestV_AA0bC5StateVys6ResultOyAIs5Error_pGYbctF) `
#### Declaration
---
# AlamofireNotifications Class Reference
AlamofireNotifications
======================
`[EventMonitor](../Protocols/EventMonitor.html) ` that provides Alamofire’s notifications.
* `[init()](#/s:9Alamofire0A13NotificationsCACycfc) `
Creates an instance.
#### Declaration
* `[requestDidResume(_:)](#/s:9Alamofire12EventMonitorP16requestDidResumeyyAA7RequestCF) `
#### Declaration
* `[requestDidSuspend(_:)](#/s:9Alamofire12EventMonitorP17requestDidSuspendyyAA7RequestCF) `
#### Declaration
* `[requestDidCancel(_:)](#/s:9Alamofire12EventMonitorP16requestDidCancelyyAA7RequestCF) `
#### Declaration
* `[requestDidFinish(_:)](#/s:9Alamofire12EventMonitorP16requestDidFinishyyAA7RequestCF) `
#### Declaration
* `[request(_:didResumeTask:)](#/s:9Alamofire12EventMonitorP7request_13didResumeTaskyAA7RequestC_So012NSURLSessionG0CtF) `
#### Declaration
* `[request(_:didSuspendTask:)](#/s:9Alamofire12EventMonitorP7request_14didSuspendTaskyAA7RequestC_So012NSURLSessionG0CtF) `
#### Declaration
* `[request(_:didCancelTask:)](#/s:9Alamofire12EventMonitorP7request_13didCancelTaskyAA7RequestC_So012NSURLSessionG0CtF) `
#### Declaration
* `[request(_:didCompleteTask:with:)](#/s:9Alamofire12EventMonitorP7request_15didCompleteTask4withyAA7RequestC_So012NSURLSessionG0CAA7AFErrorOSgtF) `
#### Declaration
---
# Alamofire Reference

[](https://img.shields.io/badge/Swift-5.9_5.10_6.0-Orange?style=flat-square)
[](https://img.shields.io/badge/Platforms-macOS_iOS_tvOS_watchOS_vision_OS_Linux_Windows_Android-Green?style=flat-square)
[](https://img.shields.io/cocoapods/v/Alamofire.svg)
[](https://github.com/Carthage/Carthage)
[](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square)
[](https://forums.swift.org/c/related-projects/alamofire/37)
Alamofire is an HTTP networking library written in Swift.
* [Features](#features)
* [Component Libraries](#component-libraries)
* [Requirements](#requirements)
* [Migration Guides](#migration-guides)
* [Communication](#communication)
* [Installation](#installation)
* [Contributing](#contributing)
* [Usage](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#using-alamofire)
* [**Introduction -**](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#introduction)
[Making Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#making-requests)
, [Response Handling](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-handling)
, [Response Validation](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-validation)
, [Response Caching](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-caching)
* **HTTP -** [HTTP Methods](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#http-methods)
, [Parameters and Parameter Encoder](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md##request-parameters-and-parameter-encoders)
, [HTTP Headers](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#http-headers)
, [Authentication](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#authentication)
* **Large Data -** [Downloading Data to a File](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#downloading-data-to-a-file)
, [Uploading Data to a Server](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#uploading-data-to-a-server)
* **Tools -** [Statistical Metrics](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#statistical-metrics)
, [cURL Command Output](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#curl-command-output)
* [Advanced Usage](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md)
* **URL Session -** [Session Manager](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#session)
, [Session Delegate](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#sessiondelegate)
, [Request](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#request)
* **Routing -** [Routing Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#routing-requests)
, [Adapting and Retrying Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#adapting-and-retrying-requests-with-requestinterceptor)
* **Model Objects -** [Custom Response Handlers](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#customizing-response-handlers)
* **Advanced Concurrency -** [Swift Concurrency](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#using-alamofire-with-swift-concurrency)
and [Combine](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#using-alamofire-with-combine)
* **Connection -** [Security](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#security)
, [Network Reachability](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#network-reachability)
* [Open Radars](#open-radars)
* [FAQ](#faq)
* [Credits](#credits)
* [Donations](#donations)
* [License](#license)
Features
--------
* \[x\] Chainable Request / Response Methods
* \[x\] Swift Concurrency Support Back to iOS 13, macOS 10.15, tvOS 13, and watchOS 6.
* \[x\] Combine Support
* \[x\] URL / JSON Parameter Encoding
* \[x\] Upload File / Data / Stream / MultipartFormData
* \[x\] Download File using Request or Resume Data
* \[x\] Authentication with `URLCredential`
* \[x\] HTTP Response Validation
* \[x\] Upload and Download Progress Closures with Progress
* \[x\] cURL Command Output
* \[x\] Dynamically Adapt and Retry Requests
* \[x\] TLS Certificate and Public Key Pinning
* \[x\] Network Reachability
* \[x\] Comprehensive Unit and Integration Test Coverage
* \[x\] [Complete Documentation](https://alamofire.github.io/Alamofire)
Write Requests Fast!
--------------------
Alamofire’s compact syntax and extensive feature set allow requests with powerful features like automatic retry to be written in just a few lines of code.
// Automatic String to URL conversion, Swift concurrency support, and automatic retry.
let response = await AF.request("https://httpbin.org/get", interceptor: .retryPolicy)
// Automatic HTTP Basic Auth.
.authenticate(username: "user", password: "pass")
// Caching customization.
.cacheResponse(using: .cache)
// Redirect customization.
.redirect(using: .follow)
// Validate response code and Content-Type.
.validate()
// Produce a cURL command for the request.
.cURLDescription { description in
print(description)
}
// Automatic Decodable support with background parsing.
.serializingDecodable(DecodableType.self)
// Await the full response with metrics and a parsed body.
.response
// Detailed response description for easy debugging.
debugPrint(response)
Component Libraries
-------------------
In order to keep Alamofire focused specifically on core networking implementations, additional component libraries have been created by the [Alamofire Software Foundation](https://github.com/Alamofire/Foundation)
to bring additional functionality to the Alamofire ecosystem.
* [AlamofireImage](https://github.com/Alamofire/AlamofireImage)
- An image library including image response serializers, `UIImage` and `UIImageView` extensions, custom image filters, an auto-purging in-memory cache, and a priority-based image downloading system.
* [AlamofireNetworkActivityIndicator](https://github.com/Alamofire/AlamofireNetworkActivityIndicator)
- Controls the visibility of the network activity indicator on iOS using Alamofire. It contains configurable delay timers to help mitigate flicker and can support `URLSession` instances not managed by Alamofire.
Requirements
------------
| Platform | Minimum Swift Version | Installation | Status |
| --- | --- | --- | --- |
| iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+ | 5.9 / Xcode 15.0 | [CocoaPods](#cocoapods)
, [Carthage](#carthage)
, [Swift Package Manager](#swift-package-manager)
, [Manual](#manually) | Fully Tested |
| Linux | Latest Only | [Swift Package Manager](#swift-package-manager) | Building But Unsupported |
| Windows | Latest Only | [Swift Package Manager](#swift-package-manager) | Building But Unsupported |
| Android | Latest Only | [Swift Package Manager](#swift-package-manager) | Building But Unsupported |
#### Known Issues on Linux and Windows
Alamofire builds on Linux, Windows, and Android but there are missing features and many issues in the underlying `swift-corelibs-foundation` that prevent full functionality and may cause crashes. These include:
* `[ServerTrustManager](Classes/ServerTrustManager.html) ` and associated certificate functionality is unavailable, so there is no certificate pinning and no client certificate support.
* Various methods of HTTP authentication may crash, including HTTP Basic and HTTP Digest. Crashes may occur if responses contain server challenges.
* Cache control through `[CachedResponseHandler](Protocols/CachedResponseHandler.html) ` and associated APIs is unavailable, as the underlying delegate methods aren’t called.
* `URLSessionTaskMetrics` are never gathered.
* `WebSocketRequest` is not available.
Due to these issues, Alamofire is unsupported on Linux, Windows, and Android. Please report any crashes to the [Swift bug reporter](https://bugs.swift.org)
.
Migration Guides
----------------
* [Alamofire 5.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%205.0%20Migration%20Guide.md)
* [Alamofire 4.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%204.0%20Migration%20Guide.md)
* [Alamofire 3.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%203.0%20Migration%20Guide.md)
* [Alamofire 2.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%202.0%20Migration%20Guide.md)
Communication
-------------
* If you **need help with making network requests** using Alamofire, use [Stack Overflow](https://stackoverflow.com/questions/tagged/alamofire)
and tag `alamofire`.
* If you need to **find or understand an API**, check [our documentation](http://alamofire.github.io/Alamofire/)
or [Apple’s documentation for `URLSession`](https://developer.apple.com/documentation/foundation/url_loading_system)
, on top of which Alamofire is built.
* If you need **help with an Alamofire feature**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire)
.
* If you’d like to **discuss Alamofire best practices**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire)
.
* If you’d like to **discuss a feature request**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire)
.
* If you **found a bug**, open an issue here on GitHub and follow the guide. The more detail the better!
Installation
------------
### Swift Package Manager
The [Swift Package Manager](https://swift.org/package-manager/)
is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler.
Once you have your Swift package set up, adding Alamofire as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift` or the Package list in Xcode.
dependencies: [\
.package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.10.0"))\
]
Normally you’ll want to depend on the `Alamofire` target:
.product(name: "Alamofire", package: "Alamofire")
But if you want to force Alamofire to be dynamically linked (do not do this unless you’re sure you need it), you can depend on the `AlamofireDynamic` target:
.product(name: "AlamofireDynamic", package: "Alamofire")
### CocoaPods
[CocoaPods](https://cocoapods.org)
is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Alamofire into your Xcode project using CocoaPods, specify it in your `Podfile`:
pod 'Alamofire'
### Carthage
[Carthage](https://github.com/Carthage/Carthage)
is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate Alamofire into your Xcode project using Carthage, specify it in your `Cartfile`:
github "Alamofire/Alamofire"
### Manually
If you prefer not to use any of the aforementioned dependency managers, you can integrate Alamofire into your project manually.
#### Embedded Framework
* Open up Terminal, `cd` into your top-level project directory, and run the following command “if” your project is not initialized as a git repository:
$ git init
* Add Alamofire as a git [submodule](https://git-scm.com/docs/git-submodule)
by running the following command:
$ git submodule add https://github.com/Alamofire/Alamofire.git
* Open the new `Alamofire` folder, and drag the `Alamofire.xcodeproj` into the Project Navigator of your application’s Xcode project.
> It should appear nested underneath your application’s blue project icon. Whether it is above or below all the other Xcode groups does not matter.
* Select the `Alamofire.xcodeproj` in the Project Navigator and verify the deployment target matches that of your application target.
* Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the “Targets” heading in the sidebar.
* In the tab bar at the top of that window, open the “General” panel.
* Click on the `+` button under the “Embedded Binaries” section.
* You will see two different `Alamofire.xcodeproj` folders each with two different versions of the `Alamofire.framework` nested inside a `Products` folder.
> It does not matter which `Products` folder you choose from, but it does matter whether you choose the top or bottom `Alamofire.framework`.
* Select the top `Alamofire.framework` for iOS and the bottom one for macOS.
> You can verify which one you selected by inspecting the build log for your project. The build target for `Alamofire` will be listed as `Alamofire iOS`, `Alamofire macOS`, `Alamofire tvOS`, or `Alamofire watchOS`.
* And that’s it!
> The `Alamofire.framework` is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device.
Contributing
------------
Before contributing to Alamofire, please read the instructions detailed in our [contribution guide](https://github.com/Alamofire/Alamofire/blob/master/CONTRIBUTING.md)
.
Open Radars
-----------
The following radars have some effect on the current implementation of Alamofire.
* [`rdar://21349340`](http://www.openradar.me/radar?id=5517037090635776)
- Compiler throwing warning due to toll-free bridging issue in the test case
* `rdar://26870455` - Background URL Session Configurations do not work in the simulator
* `rdar://26849668` - Some URLProtocol APIs do not properly handle `URLRequest`
Resolved Radars
---------------
The following radars have been resolved over time after being filed against the Alamofire project.
* [`rdar://26761490`](http://www.openradar.me/radar?id=5010235949318144)
- Swift string interpolation causing memory leak with common usage.
* (Resolved): 9/1/17 in Xcode 9 beta 6.
* [`rdar://36082113`](http://openradar.appspot.com/radar?id=4942308441063424)
- `URLSessionTaskMetrics` failing to link on watchOS 3.0+
* (Resolved): Just add `CFNetwork` to your linked frameworks.
* `FB7624529` - `urlSession(_:task:didFinishCollecting:)` never called on watchOS
* (Resolved): Metrics now collected on watchOS 7+.
FAQ
---
### What’s the origin of the name Alamofire?
Alamofire is named after the [Alamo Fire flower](https://aggie-horticulture.tamu.edu/wildseed/alamofire.html)
, a hybrid variant of the Bluebonnet, the official state flower of Texas.
Credits
-------
Alamofire is owned and maintained by the [Alamofire Software Foundation](http://alamofire.org)
. You can follow them on Twitter at [@AlamofireSF](https://twitter.com/AlamofireSF)
for project updates and releases.
### Security Disclosure
If you believe you have identified a security vulnerability with Alamofire, you should report it as soon as possible via email to [security@alamofire.org](mailto:security@alamofire.org)
. Please do not post it to a public issue tracker.
Sponsorship
-----------
The [ASF](https://github.com/Alamofire/Foundation#members)
is looking to raise money to officially stay registered as a federal non-profit organization. Registering will allow Foundation members to gain some legal protections and also allow us to put donations to use, tax-free. Sponsoring the ASF will enable us to:
* Pay our yearly legal fees to keep the non-profit in good status
* Pay for our mail servers to help us stay on top of all questions and security issues
* Potentially fund test servers to make it easier for us to test the edge cases
* Potentially fund developers to work on one of our projects full-time
The community adoption of the ASF libraries has been amazing. We are greatly humbled by your enthusiasm around the projects and want to continue to do everything we can to move the needle forward. With your continued support, the ASF will be able to improve its reach and also provide better legal safety for the core members. If you use any of our libraries for work, see if your employers would be interested in donating. Any amount you can donate, whether once or monthly, to help us reach our goal would be greatly appreciated.
[Sponsor Alamofire](https://github.com/sponsors/Alamofire)
Supporters
----------
[MacStadium](https://macstadium.com)
provides Alamofire with a free, hosted Mac mini.

License
-------
Alamofire is released under the MIT license. [See LICENSE](https://github.com/Alamofire/Alamofire/blob/master/LICENSE)
for details.
---
# Classes Reference
Classes
=======
The following classes are available globally.
* `[DataRequest](#/s:9Alamofire11DataRequestC) `
`[Request](Classes/Request.html) ` subclass which handles in-memory `Data` download using `URLSessionDataTask`.
[See more](Classes/DataRequest.html)
#### Declaration
* `[DataStreamRequest](#/s:9Alamofire17DataStreamRequestC) `
`[Request](Classes/Request.html) ` subclass which streams HTTP response `Data` through a `Handler` closure.
[See more](Classes/DataStreamRequest.html)
#### Declaration
* `[DownloadRequest](#/s:9Alamofire15DownloadRequestC) `
`[Request](Classes/Request.html) ` subclass which downloads `Data` to a file on disk using `URLSessionDownloadTask`.
[See more](Classes/DownloadRequest.html)
#### Declaration
* `[Request](#/s:9Alamofire7RequestC) `
`Request` is the common superclass of all Alamofire request types and provides common state, delegate, and callback handling.
[See more](Classes/Request.html)
#### Declaration
* `[AlamofireNotifications](#/s:9Alamofire0A13NotificationsC) `
`[EventMonitor](Protocols/EventMonitor.html) ` that provides Alamofire’s notifications.
[See more](Classes/AlamofireNotifications.html)
#### Declaration
* `[JSONParameterEncoder](#/s:9Alamofire20JSONParameterEncoderC) `
A `[ParameterEncoder](Protocols/ParameterEncoder.html) ` that encodes types as JSON body data.
If no `Content-Type` header is already set on the provided `URLRequest`s, it’s set to `application/json`.
[See more](Classes/JSONParameterEncoder.html)
#### Declaration
* `[URLEncodedFormParameterEncoder](#/s:9Alamofire30URLEncodedFormParameterEncoderC) `
A `[ParameterEncoder](Protocols/ParameterEncoder.html) ` that encodes types as URL-encoded query strings to be set on the URL or as body data, depending on the `Destination` set.
If no `Content-Type` header is already set on the provided `URLRequest`s, it will be set to `application/x-www-form-urlencoded; charset=utf-8`.
Encoding behavior can be customized by passing an instance of `[URLEncodedFormEncoder](Classes/URLEncodedFormEncoder.html) ` to the initializer.
[See more](Classes/URLEncodedFormParameterEncoder.html)
#### Declaration
* `[Session](#/s:9Alamofire7SessionC) `
`Session` creates and manages Alamofire’s `[Request](Classes/Request.html) ` types during their lifetimes. It also provides common functionality for all `[Request](Classes/Request.html) `s, including queuing, interception, trust management, redirect handling, and response cache handling.
[See more](Classes/Session.html)
#### Declaration
* `[SessionDelegate](#/c:@M@Alamofire@objc(cs)SessionDelegate) `
Class which implements the various `URLSessionDelegate` methods to connect various Alamofire features.
[See more](Classes/SessionDelegate.html)
#### Declaration
* `[UploadRequest](#/s:9Alamofire13UploadRequestC) `
`[DataRequest](Classes/DataRequest.html) ` subclass which handles `Data` upload from memory, file, or stream using `URLSessionUploadTask`.
[See more](Classes/UploadRequest.html)
#### Declaration
* `[AuthenticationInterceptor](#/s:9Alamofire25AuthenticationInterceptorC) `
The `AuthenticationInterceptor` class manages the queuing and threading complexity of authenticating requests. It relies on an `[Authenticator](Protocols/Authenticator.html) ` type to handle the actual `URLRequest` authentication and `Credential` refresh.
[See more](Classes/AuthenticationInterceptor.html)
#### Declaration
* `[CompositeEventMonitor](#/s:9Alamofire21CompositeEventMonitorC) `
An `[EventMonitor](Protocols/EventMonitor.html) ` which can contain multiple `[EventMonitor](Protocols/EventMonitor.html) `s and calls their methods on their queues.
[See more](Classes/CompositeEventMonitor.html)
#### Declaration
* `[ClosureEventMonitor](#/s:9Alamofire19ClosureEventMonitorC) `
`[EventMonitor](Protocols/EventMonitor.html) ` that allows optional closures to be set to receive events.
[See more](Classes/ClosureEventMonitor.html)
#### Declaration
* `[MultipartFormData](#/s:9Alamofire17MultipartFormDataC) `
Constructs `multipart/form-data` for uploads within an HTTP or HTTPS body. There are currently two ways to encode multipart form data. The first way is to encode the data directly in memory. This is very efficient, but can lead to memory issues if the dataset is too large. The second way is designed for larger datasets and will write all the data to a single file on disk with all the proper boundary segmentation. The second approach MUST be used for larger datasets such as video content, otherwise your app may run out of memory when trying to encode the dataset.
For more information on `multipart/form-data` in general, please refer to the RFC-2388 and RFC-2045 specs as well and the w3 form documentation.
* [https://www.ietf.org/rfc/rfc2388.txt](https://www.ietf.org/rfc/rfc2388.txt)
* [https://www.ietf.org/rfc/rfc2045.txt](https://www.ietf.org/rfc/rfc2045.txt)
* [https://www.w3.org/TR/html401/interact/forms.html#h-17.13](https://www.w3.org/TR/html401/interact/forms.html#h-17.13)
[See more](Classes/MultipartFormData.html)
#### Declaration
* `[NetworkReachabilityManager](#/s:9Alamofire26NetworkReachabilityManagerC) `
The `NetworkReachabilityManager` class listens for reachability changes of hosts and addresses for both cellular and WiFi network interfaces.
Reachability can be used to determine background information about why a network operation failed, or to retry network requests when a connection is established. It should not be used to prevent a user from initiating a network request, as it’s possible that an initial request may be required to establish reachability.
[See more](Classes/NetworkReachabilityManager.html)
#### Declaration
* `[Adapter](#/s:9Alamofire7AdapterC) `
Closure-based `[RequestAdapter](Protocols/RequestAdapter.html) `.
[See more](Classes/Adapter.html)
#### Declaration
* `[Retrier](#/s:9Alamofire7RetrierC) `
Closure-based `[RequestRetrier](Protocols/RequestRetrier.html) `.
[See more](Classes/Retrier.html)
#### Declaration
* `[Interceptor](#/s:9Alamofire11InterceptorC) `
`[RequestInterceptor](Protocols/RequestInterceptor.html) ` which can use multiple `[RequestAdapter](Protocols/RequestAdapter.html) ` and `[RequestRetrier](Protocols/RequestRetrier.html) ` values.
[See more](Classes/Interceptor.html)
#### Declaration
[](#/Data)
### Data
* `[DataResponseSerializer](#/s:9Alamofire22DataResponseSerializerC) `
A `[ResponseSerializer](Protocols/ResponseSerializer.html) ` that performs minimal response checking and returns any response `Data` as-is. By default, a request returning `nil` or no data is considered an error. However, if the request has an `[HTTPMethod](Structs/HTTPMethod.html) ` or the response has an HTTP status code valid for empty responses, then an empty `Data` value is returned.
[See more](Classes/DataResponseSerializer.html)
#### Declaration
[](#/String)
### String
* `[StringResponseSerializer](#/s:9Alamofire24StringResponseSerializerC) `
A `[ResponseSerializer](Protocols/ResponseSerializer.html) ` that decodes the response data as a `String`. By default, a request returning `nil` or no data is considered an error. However, if the request has an `[HTTPMethod](Structs/HTTPMethod.html) ` or the response has an HTTP status code valid for empty responses, then an empty `String` is returned.
[See more](Classes/StringResponseSerializer.html)
#### Declaration
[](#/JSON)
### JSON
* `[JSONResponseSerializer](#/s:9Alamofire22JSONResponseSerializerC) `
A `[ResponseSerializer](Protocols/ResponseSerializer.html) ` that decodes the response data using `JSONSerialization`. By default, a request returning `nil` or no data is considered an error. However, if the request has an `[HTTPMethod](Structs/HTTPMethod.html) ` or the response has an HTTP status code valid for empty responses, then an `NSNull` value is returned.
[See more](Classes/JSONResponseSerializer.html)
#### Declaration
[](#/Decodable)
### Decodable
* `[DecodableResponseSerializer](#/s:9Alamofire27DecodableResponseSerializerC) `
A `[ResponseSerializer](Protocols/ResponseSerializer.html) ` that decodes the response data as a `Decodable` value using any decoder that conforms to `[DataDecoder](Protocols/DataDecoder.html) `. By default, this is an instance of `JSONDecoder`.
[See more](Classes/DecodableResponseSerializer.html)
#### Declaration
* `[RetryPolicy](#/s:9Alamofire11RetryPolicyC) `
A retry policy that retries requests using an exponential backoff for allowed HTTP methods and HTTP status codes as well as certain types of networking errors.
[See more](Classes/RetryPolicy.html)
#### Declaration
* `[ConnectionLostRetryPolicy](#/s:9Alamofire25ConnectionLostRetryPolicyC) `
A retry policy that automatically retries idempotent requests for network connection lost errors. For more information about retrying network connection lost errors, please refer to Apple’s [technical document](https://developer.apple.com/library/content/qa/qa1941/_index.html)
.
[See more](Classes/ConnectionLostRetryPolicy.html)
#### Declaration
* `[ServerTrustManager](#/s:9Alamofire18ServerTrustManagerC) `
Responsible for managing the mapping of `[ServerTrustEvaluating](Protocols/ServerTrustEvaluating.html) ` values to given hosts.
[See more](Classes/ServerTrustManager.html)
#### Declaration
[](#/Server%20Trust%20Evaluators)
### Server Trust Evaluators
* `[DefaultTrustEvaluator](#/s:9Alamofire21DefaultTrustEvaluatorC) `
An evaluator which uses the default server trust evaluation while allowing you to control whether to validate the host provided by the challenge. Applications are encouraged to always validate the host in production environments to guarantee the validity of the server’s certificate chain.
[See more](Classes/DefaultTrustEvaluator.html)
#### Declaration
* `[RevocationTrustEvaluator](#/s:9Alamofire24RevocationTrustEvaluatorC) `
An evaluator which Uses the default and revoked server trust evaluations allowing you to control whether to validate the host provided by the challenge as well as specify the revocation flags for testing for revoked certificates. Apple platforms did not start testing for revoked certificates automatically until iOS 10.1, macOS 10.12 and tvOS 10.1 which is demonstrated in our TLS tests. Applications are encouraged to always validate the host in production environments to guarantee the validity of the server’s certificate chain.
[See more](Classes/RevocationTrustEvaluator.html)
#### Declaration
* `[PinnedCertificatesTrustEvaluator](#/s:9Alamofire32PinnedCertificatesTrustEvaluatorC) `
Uses the pinned certificates to validate the server trust. The server trust is considered valid if one of the pinned certificates match one of the server certificates. By validating both the certificate chain and host, certificate pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks. Applications are encouraged to always validate the host and require a valid certificate chain in production environments.
[See more](Classes/PinnedCertificatesTrustEvaluator.html)
#### Declaration
* `[PublicKeysTrustEvaluator](#/s:9Alamofire24PublicKeysTrustEvaluatorC) `
Uses the pinned public keys to validate the server trust. The server trust is considered valid if one of the pinned public keys match one of the server certificate public keys. By validating both the certificate chain and host, public key pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks. Applications are encouraged to always validate the host and require a valid certificate chain in production environments.
[See more](Classes/PublicKeysTrustEvaluator.html)
#### Declaration
* `[CompositeTrustEvaluator](#/s:9Alamofire23CompositeTrustEvaluatorC) `
Uses the provided evaluators to validate the server trust. The trust is only considered valid if all of the evaluators consider it valid.
[See more](Classes/CompositeTrustEvaluator.html)
#### Declaration
* `[DisabledTrustEvaluator](#/s:9Alamofire22DisabledTrustEvaluatorC) `
Disables all evaluation which in turn will always consider any server trust as valid.
**THIS EVALUATOR SHOULD NEVER BE USED IN PRODUCTION!**
[See more](Classes/DisabledTrustEvaluator.html)
#### Declaration
* `[URLEncodedFormEncoder](#/s:9Alamofire21URLEncodedFormEncoderC) `
An object that encodes instances into URL-encoded query strings.
`ArrayEncoding` can be used to configure how `Array` values are encoded. By default, the `.brackets` encoding is used, encoding array values with brackets for each value. e.g `array[]=1&array[]=2`.
`BoolEncoding` can be used to configure how `Bool` values are encoded. By default, the `.numeric` encoding is used, encoding `true` as `1` and `false` as `0`.
`DataEncoding` can be used to configure how `Data` values are encoded. By default, the `.deferredToData` encoding is used, which encodes `Data` values using their default `Encodable` implementation.
`DateEncoding` can be used to configure how `Date` values are encoded. By default, the `.deferredToDate` encoding is used, which encodes `Date`s using their default `Encodable` implementation.
`KeyEncoding` can be used to configure how keys are encoded. By default, the `.useDefaultKeys` encoding is used, which encodes the keys directly from the `Encodable` implementation.
`KeyPathEncoding` can be used to configure how paths within nested objects are encoded. By default, the `.brackets` encoding is used, which encodes each sub-key in brackets. e.g. `parent[child][grandchild]=value`.
`NilEncoding` can be used to configure how `nil` `Optional` values are encoded. By default, the `.dropKey` encoding is used, which drops `nil` key / value pairs from the output entirely.
`SpaceEncoding` can be used to configure how spaces are encoded. By default, the `.percentEscaped` encoding is used, replacing spaces with `%20`.
This type is largely based on Vapor’s [`url-encoded-form`](https://github.com/vapor/url-encoded-form)
project.
[See more](Classes/URLEncodedFormEncoder.html)
#### Declaration
---
# AuthenticationInterceptor Class Reference
AuthenticationInterceptor
=========================
The `AuthenticationInterceptor` class manages the queuing and threading complexity of authenticating requests. It relies on an `[Authenticator](../Protocols/Authenticator.html) ` type to handle the actual `URLRequest` authentication and `Credential` refresh.
[](#/Typealiases)
### Typealiases
* `[Credential](#/s:9Alamofire25AuthenticationInterceptorC10Credentiala) `
Type of credential used to authenticate requests.
#### Declaration
[](#/Helper%20Types)
### Helper Types
* `[RefreshWindow](#/s:9Alamofire25AuthenticationInterceptorC13RefreshWindowV) `
Type that defines a time window used to identify excessive refresh calls. When enabled, prior to executing a refresh, the `[AuthenticationInterceptor](../Classes/AuthenticationInterceptor.html) ` compares the timestamp history of previous refresh calls against the `RefreshWindow`. If more refreshes have occurred within the refresh window than allowed, the refresh is cancelled and an `AuthorizationError.excessiveRefresh` error is thrown.
[See more](../Classes/AuthenticationInterceptor/RefreshWindow.html)
#### Declaration
[](#/Properties)
### Properties
* `[credential](#/s:9Alamofire25AuthenticationInterceptorC10credential10CredentialQzSgvp) `
The `[Credential](../Classes/AuthenticationInterceptor.html#/s:9Alamofire25AuthenticationInterceptorC10Credentiala) ` used to authenticate requests.
#### Declaration
[](#/Initialization)
### Initialization
* `[init(authenticator:credential:refreshWindow:)](#/s:9Alamofire25AuthenticationInterceptorC13authenticator10credential13refreshWindowACyxGx_10CredentialQzSgAC07RefreshG0Vyx_GSgtcfc) `
Creates an `AuthenticationInterceptor` instance from the specified parameters.
A `nil` `[RefreshWindow](../Classes/AuthenticationInterceptor/RefreshWindow.html) ` will result in the `AuthenticationInterceptor` not checking for excessive refresh calls. It is recommended to always use a `[RefreshWindow](../Classes/AuthenticationInterceptor/RefreshWindow.html) ` to avoid endless refresh cycles.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_authenticator_` | The `[Authenticator](../Protocols/Authenticator.html) ` type. |
| `_credential_` | The `[Credential](../Classes/AuthenticationInterceptor.html#/s:9Alamofire25AuthenticationInterceptorC10Credentiala) ` if it exists. `nil` by default. |
| `_refreshWindow_` | The `[RefreshWindow](../Classes/AuthenticationInterceptor/RefreshWindow.html) ` used to identify excessive refresh calls. `RefreshWindow()` by default. |
[](#/Adapt)
### Adapt
* `[adapt(_:for:completion:)](#/s:9Alamofire14RequestAdapterP5adapt_3for10completiony10Foundation10URLRequestV_AA7SessionCys6ResultOyAIs5Error_pGYbctF) `
#### Declaration
[](#/Retry)
### Retry
* `[retry(_:for:dueTo:completion:)](#/s:9Alamofire14RequestRetrierP5retry_3for5dueTo10completionyAA0B0C_AA7SessionCs5Error_pyAA11RetryResultOYbctF) `
#### Declaration
---
# RefreshWindow Structure Reference
RefreshWindow
=============
Type that defines a time window used to identify excessive refresh calls. When enabled, prior to executing a refresh, the `[AuthenticationInterceptor](../../Classes/AuthenticationInterceptor.html) ` compares the timestamp history of previous refresh calls against the `RefreshWindow`. If more refreshes have occurred within the refresh window than allowed, the refresh is cancelled and an `AuthorizationError.excessiveRefresh` error is thrown.
* `[interval](#/s:9Alamofire25AuthenticationInterceptorC13RefreshWindowV8intervalSdvp) `
`TimeInterval` defining the duration of the time window before the current time in which the number of refresh attempts is compared against `[maximumAttempts](../../Classes/AuthenticationInterceptor/RefreshWindow.html#/s:9Alamofire25AuthenticationInterceptorC13RefreshWindowV15maximumAttemptsSivp) `. For example, if `interval` is 30 seconds, then the `RefreshWindow` represents the past 30 seconds. If more attempts occurred in the past 30 seconds than `[maximumAttempts](../../Classes/AuthenticationInterceptor/RefreshWindow.html#/s:9Alamofire25AuthenticationInterceptorC13RefreshWindowV15maximumAttemptsSivp) `, an `.excessiveRefresh` error will be thrown.
#### Declaration
* `[maximumAttempts](#/s:9Alamofire25AuthenticationInterceptorC13RefreshWindowV15maximumAttemptsSivp) `
Total refresh attempts allowed within `[interval](../../Classes/AuthenticationInterceptor/RefreshWindow.html#/s:9Alamofire25AuthenticationInterceptorC13RefreshWindowV8intervalSdvp) ` before throwing an `.excessiveRefresh` error.
#### Declaration
* `[init(interval:maximumAttempts:)](#/s:9Alamofire25AuthenticationInterceptorC13RefreshWindowV8interval15maximumAttemptsAEyx_GSd_Sitcfc) `
Creates a `RefreshWindow` instance from the specified `[interval](../../Classes/AuthenticationInterceptor/RefreshWindow.html#/s:9Alamofire25AuthenticationInterceptorC13RefreshWindowV8intervalSdvp) ` and `[maximumAttempts](../../Classes/AuthenticationInterceptor/RefreshWindow.html#/s:9Alamofire25AuthenticationInterceptorC13RefreshWindowV15maximumAttemptsSivp) `.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_interval_` | `TimeInterval` defining the duration of the time window before the current time. |
| `_maximumAttempts_` | The maximum attempts allowed within the `TimeInterval`. |
---
# CompositeTrustEvaluator Class Reference
CompositeTrustEvaluator
=======================
Uses the provided evaluators to validate the server trust. The trust is only considered valid if all of the evaluators consider it valid.
* `[init(evaluators:)](#/s:9Alamofire23CompositeTrustEvaluatorC10evaluatorsACSayAA06ServerC10Evaluating_pG_tcfc) `
Creates a `CompositeTrustEvaluator` from the provided evaluators.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_evaluators_` | The `[ServerTrustEvaluating](../Protocols/ServerTrustEvaluating.html) ` values used to evaluate the server trust. |
* `[evaluate(_:forHost:)](#/s:9Alamofire21ServerTrustEvaluatingP8evaluate_7forHostySo03SecC3Refa_SStKF) `
#### Declaration
---
# ClosureEventMonitor Class Reference
ClosureEventMonitor
===================
`[EventMonitor](../Protocols/EventMonitor.html) ` that allows optional closures to be set to receive events.
* `[sessionDidBecomeInvalidWithError](#/s:9Alamofire19ClosureEventMonitorC32sessionDidBecomeInvalidWithErrorySo12NSURLSessionC_s0J0_pSgtcSgvp) `
Closure called on the `[urlSession(_:didBecomeInvalidWithError:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP10urlSession_25didBecomeInvalidWithErrorySo12NSURLSessionC_s0J0_pSgtF) ` event.
#### Declaration
* `[taskDidReceiveChallenge](#/s:9Alamofire19ClosureEventMonitorC23taskDidReceiveChallengeySo12NSURLSessionC_So0I4TaskCSo019NSURLAuthenticationH0CtcSgvp) `
Closure called on the `urlSession(_:task:didReceive:completionHandler:)`.
#### Declaration
* `[taskDidSendBodyData](#/s:9Alamofire19ClosureEventMonitorC19taskDidSendBodyDataySo12NSURLSessionC_So0J4TaskCs5Int64VA2JtcSgvp) `
Closure that receives `[urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP10urlSession_4task15didSendBodyData14totalBytesSent0kl10ExpectedToH0ySo12NSURLSessionC_So0P4TaskCs5Int64VA2NtF) ` event.
#### Declaration
* `[taskNeedNewBodyStream](#/s:9Alamofire19ClosureEventMonitorC21taskNeedNewBodyStreamySo12NSURLSessionC_So0J4TaskCtcSgvp) `
Closure called on the `urlSession(_:task:needNewBodyStream:)` event.
#### Declaration
* `[taskWillPerformHTTPRedirection](#/s:9Alamofire19ClosureEventMonitorC30taskWillPerformHTTPRedirectionySo12NSURLSessionC_So0I4TaskCSo17NSHTTPURLResponseC10Foundation10URLRequestVtcSgvp) `
Closure called on the `urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)` event.
#### Declaration
* `[taskDidFinishCollectingMetrics](#/s:9Alamofire19ClosureEventMonitorC30taskDidFinishCollectingMetricsySo12NSURLSessionC_So0J4TaskCSo0jkI0CtcSgvp) `
Closure called on the `[urlSession(_:task:didFinishCollecting:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP10urlSession_4task19didFinishCollectingySo12NSURLSessionC_So0J4TaskCSo0jK7MetricsCtF) ` event.
#### Declaration
* `[taskDidComplete](#/s:9Alamofire19ClosureEventMonitorC15taskDidCompleteySo12NSURLSessionC_So0H4TaskCs5Error_pSgtcSgvp) `
Closure called on the `[urlSession(_:task:didCompleteWithError:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP10urlSession_4task20didCompleteWithErrorySo12NSURLSessionC_So0K4TaskCs0J0_pSgtF) ` event.
#### Declaration
* `[taskIsWaitingForConnectivity](#/s:9Alamofire19ClosureEventMonitorC28taskIsWaitingForConnectivityySo12NSURLSessionC_So0J4TaskCtcSgvp) `
Closure called on the `[urlSession(_:taskIsWaitingForConnectivity:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP10urlSession_28taskIsWaitingForConnectivityySo12NSURLSessionC_So0K4TaskCtF) ` event.
#### Declaration
* `[dataTaskDidReceiveResponse](#/s:9Alamofire19ClosureEventMonitorC26dataTaskDidReceiveResponseySo12NSURLSessionC_So0j4DataF0CSo13NSURLResponseCtcSgvp) `
Closure called on the `urlSession(_:dataTask:didReceive:completionHandler:)` event.
#### Declaration
* `[dataTaskDidReceiveData](#/s:9Alamofire19ClosureEventMonitorC22dataTaskDidReceiveDataySo12NSURLSessionC_So0jiF0C10Foundation0I0VtcSgvp) `
Closure that receives the `[urlSession(_:dataTask:didReceive:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP10urlSession_8dataTask10didReceiveySo12NSURLSessionC_So0j4DataG0CSo13NSURLResponseCtF) ` event.
#### Declaration
* `[dataTaskWillCacheResponse](#/s:9Alamofire19ClosureEventMonitorC25dataTaskWillCacheResponseySo12NSURLSessionC_So0j4DataF0CSo19NSCachedURLResponseCtcSgvp) `
Closure called on the `urlSession(_:dataTask:willCacheResponse:completionHandler:)` event.
#### Declaration
* `[downloadTaskDidFinishDownloadingToURL](#/s:9Alamofire19ClosureEventMonitorC37downloadTaskDidFinishDownloadingToURLySo12NSURLSessionC_So0l8DownloadF0C10Foundation0K0VtcSgvp) `
Closure called on the `[urlSession(_:downloadTask:didFinishDownloadingTo:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask22didFinishDownloadingToySo12NSURLSessionC_So0l8DownloadG0C10Foundation3URLVtF) ` event.
#### Declaration
* `[downloadTaskDidWriteData](#/s:9Alamofire19ClosureEventMonitorC24downloadTaskDidWriteDataySo12NSURLSessionC_So0j8DownloadF0Cs5Int64VA2JtcSgvp) `
Closure called on the `[urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask12didWriteData17totalBytesWritten0kl10ExpectedToI0ySo12NSURLSessionC_So0p8DownloadG0Cs5Int64VA2NtF) ` event.
#### Declaration
* `[downloadTaskDidResumeAtOffset](#/s:9Alamofire19ClosureEventMonitorC29downloadTaskDidResumeAtOffsetySo12NSURLSessionC_So0k8DownloadF0Cs5Int64VAJtcSgvp) `
Closure called on the `[urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask17didResumeAtOffset18expectedTotalBytesySo12NSURLSessionC_So0o8DownloadG0Cs5Int64VAMtF) ` event.
#### Declaration
[](#/Request%20Events)
### Request Events
* `[requestDidCreateInitialURLRequest](#/s:9Alamofire19ClosureEventMonitorC33requestDidCreateInitialURLRequestyAA7RequestC_10Foundation0I0VtcSgvp) `
Closure called on the `[request(_:didCreateInitialURLRequest:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_26didCreateInitialURLRequestyAA7RequestC_10Foundation0H0VtF) ` event.
#### Declaration
* `[requestDidFailToCreateURLRequestWithError](#/s:9Alamofire19ClosureEventMonitorC41requestDidFailToCreateURLRequestWithErroryAA7RequestC_AA7AFErrorOtcSgvp) `
Closure called on the `[request(_:didFailToCreateURLRequestWithError:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_34didFailToCreateURLRequestWithErroryAA7RequestC_AA7AFErrorOtF) ` event.
#### Declaration
* `[requestDidAdaptInitialRequestToAdaptedRequest](#/s:9Alamofire19ClosureEventMonitorC038requestDidAdaptInitialRequestToAdaptedI0yAA0I0C_10Foundation10URLRequestVAItcSgvp) `
Closure called on the `[request(_:didAdaptInitialRequest:to:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_22didAdaptInitialRequest2toyAA0H0C_10Foundation10URLRequestVAKtF) ` event.
#### Declaration
* `[requestDidFailToAdaptURLRequestWithError](#/s:9Alamofire19ClosureEventMonitorC40requestDidFailToAdaptURLRequestWithErroryAA7RequestC_10Foundation0J0VAA7AFErrorOtcSgvp) `
Closure called on the `[request(_:didFailToAdaptURLRequest:withError:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_24didFailToAdaptURLRequest9withErroryAA7RequestC_10Foundation0I0VAA7AFErrorOtF) ` event.
#### Declaration
* `[requestDidCreateURLRequest](#/s:9Alamofire19ClosureEventMonitorC26requestDidCreateURLRequestyAA7RequestC_10Foundation0H0VtcSgvp) `
Closure called on the `[request(_:didCreateURLRequest:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_19didCreateURLRequestyAA7RequestC_10Foundation0G0VtF) ` event.
#### Declaration
* `[requestDidCreateTask](#/s:9Alamofire19ClosureEventMonitorC20requestDidCreateTaskyAA7RequestC_So012NSURLSessionH0CtcSgvp) `
Closure called on the `[request(_:didCreateTask:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_13didCreateTaskyAA7RequestC_So012NSURLSessionG0CtF) ` event.
#### Declaration
* `[requestDidGatherMetrics](#/s:9Alamofire19ClosureEventMonitorC23requestDidGatherMetricsyAA7RequestC_So016NSURLSessionTaskH0CtcSgvp) `
Closure called on the `[request(_:didGatherMetrics:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_16didGatherMetricsyAA7RequestC_So016NSURLSessionTaskG0CtF) ` event.
#### Declaration
* `[requestDidFailTaskEarlyWithError](#/s:9Alamofire19ClosureEventMonitorC32requestDidFailTaskEarlyWithErroryAA7RequestC_So012NSURLSessionH0CAA7AFErrorOtcSgvp) `
Closure called on the `[request(_:didFailTask:earlyWithError:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_11didFailTask14earlyWithErroryAA7RequestC_So012NSURLSessionG0CAA7AFErrorOtF) ` event.
#### Declaration
* `[requestDidCompleteTaskWithError](#/s:9Alamofire19ClosureEventMonitorC31requestDidCompleteTaskWithErroryAA7RequestC_So012NSURLSessionH0CAA7AFErrorOSgtcSgvp) `
Closure called on the `[request(_:didCompleteTask:with:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_15didCompleteTask4withyAA7RequestC_So012NSURLSessionG0CAA7AFErrorOSgtF) ` event.
#### Declaration
* `[requestIsRetrying](#/s:9Alamofire19ClosureEventMonitorC17requestIsRetryingyAA7RequestCcSgvp) `
Closure called on the `[requestIsRetrying(_:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP17requestIsRetryingyyAA7RequestCF) ` event.
#### Declaration
* `[requestDidFinish](#/s:9Alamofire19ClosureEventMonitorC16requestDidFinishyAA7RequestCcSgvp) `
Closure called on the `[requestDidFinish(_:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP16requestDidFinishyyAA7RequestCF) ` event.
#### Declaration
* `[requestDidResume](#/s:9Alamofire19ClosureEventMonitorC16requestDidResumeyAA7RequestCcSgvp) `
Closure called on the `[requestDidResume(_:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP16requestDidResumeyyAA7RequestCF) ` event.
#### Declaration
* `[requestDidResumeTask](#/s:9Alamofire19ClosureEventMonitorC20requestDidResumeTaskyAA7RequestC_So012NSURLSessionH0CtcSgvp) `
Closure called on the `[request(_:didResumeTask:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_13didResumeTaskyAA7RequestC_So012NSURLSessionG0CtF) ` event.
#### Declaration
* `[requestDidSuspend](#/s:9Alamofire19ClosureEventMonitorC17requestDidSuspendyAA7RequestCcSgvp) `
Closure called on the `[requestDidSuspend(_:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP17requestDidSuspendyyAA7RequestCF) ` event.
#### Declaration
* `[requestDidSuspendTask](#/s:9Alamofire19ClosureEventMonitorC21requestDidSuspendTaskyAA7RequestC_So012NSURLSessionH0CtcSgvp) `
Closure called on the `[request(_:didSuspendTask:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_14didSuspendTaskyAA7RequestC_So012NSURLSessionG0CtF) ` event.
#### Declaration
* `[requestDidCancel](#/s:9Alamofire19ClosureEventMonitorC16requestDidCancelyAA7RequestCcSgvp) `
Closure called on the `[requestDidCancel(_:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP16requestDidCancelyyAA7RequestCF) ` event.
#### Declaration
* `[requestDidCancelTask](#/s:9Alamofire19ClosureEventMonitorC20requestDidCancelTaskyAA7RequestC_So012NSURLSessionH0CtcSgvp) `
Closure called on the `[request(_:didCancelTask:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_13didCancelTaskyAA7RequestC_So012NSURLSessionG0CtF) ` event.
#### Declaration
* `[requestDidValidateRequestResponseDataWithResult](#/s:9Alamofire19ClosureEventMonitorC47requestDidValidateRequestResponseDataWithResultyAA0jH0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCAG0J0VSgs0L0Oyyts5Error_pGtcSgvp) `
Closure called on the `[request(_:didValidateRequest:response:data:withResult:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_18didValidateRequest8response4data10withResultyAA04DataG0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCAK0L0VSgs0K0Oyyts5Error_pGtF) ` event.
#### Declaration
* `[requestDidParseResponse](#/s:9Alamofire19ClosureEventMonitorC23requestDidParseResponseyAA11DataRequestC_AA0iH0Vy10Foundation0I0VSgAA7AFErrorOGtcSgvp) `
Closure called on the `[request(_:didParseResponse:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA11DataRequestC_AA0hG0Vy10Foundation0H0VSgAA7AFErrorOGtF) ` event.
#### Declaration
* `[requestDidValidateRequestResponseWithResult](#/s:9Alamofire19ClosureEventMonitorC43requestDidValidateRequestResponseWithResultyAA010DataStreamH0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCs0K0Oyyts5Error_pGtcSgvp) `
Closure called on the `[request(_:didValidateRequest:response:withResult:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_18didValidateRequest8response10withResultyAA010DataStreamG0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCs0J0Oyyts5Error_pGtF) ` event.
#### Declaration
* `[requestDidCreateUploadable](#/s:9Alamofire19ClosureEventMonitorC26requestDidCreateUploadableyAA13UploadRequestC_AF0H0OtcSgvp) `
Closure called on the `[request(_:didCreateUploadable:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_19didCreateUploadableyAA13UploadRequestC_AG0G0OtF) ` event.
#### Declaration
* `[requestDidFailToCreateUploadableWithError](#/s:9Alamofire19ClosureEventMonitorC41requestDidFailToCreateUploadableWithErroryAA13UploadRequestC_AA7AFErrorOtcSgvp) `
Closure called on the `[request(_:didFailToCreateUploadableWithError:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_34didFailToCreateUploadableWithErroryAA13UploadRequestC_AA7AFErrorOtF) ` event.
#### Declaration
* `[requestDidProvideInputStream](#/s:9Alamofire19ClosureEventMonitorC28requestDidProvideInputStreamyAA13UploadRequestC_So07NSInputI0CtcSgvp) `
Closure called on the `[request(_:didProvideInputStream:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_21didProvideInputStreamyAA13UploadRequestC_So07NSInputH0CtF) ` event.
#### Declaration
* `[requestDidFinishDownloadingUsingTaskWithResult](#/s:9Alamofire19ClosureEventMonitorC46requestDidFinishDownloadingUsingTaskWithResultyAA15DownloadRequestC_So012NSURLSessionJ0Cs0L0Oy10Foundation3URLVAA7AFErrorOGtcSgvp) `
Closure called on the `[request(_:didFinishDownloadingUsing:with:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_25didFinishDownloadingUsing4withyAA15DownloadRequestC_So16NSURLSessionTaskCs6ResultOy10Foundation3URLVAA7AFErrorOGtF) ` event.
#### Declaration
* `[requestDidCreateDestinationURL](#/s:9Alamofire19ClosureEventMonitorC30requestDidCreateDestinationURLyAA15DownloadRequestC_10Foundation0I0VtcSgvp) `
Closure called on the `[request(_:didCreateDestinationURL:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_23didCreateDestinationURLyAA15DownloadRequestC_10Foundation0H0VtF) ` event.
#### Declaration
* `[requestDidValidateRequestResponseFileURLWithResult](#/s:9Alamofire19ClosureEventMonitorC50requestDidValidateRequestResponseFileURLWithResultyAA08DownloadH0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCAG3URLVSgs0L0Oyyts5Error_pGtcSgvp) `
Closure called on the `request(_:didValidateRequest:response:temporaryURL:destinationURL:withResult:)` event.
#### Declaration
* `[requestDidParseDownloadResponse](#/s:9Alamofire19ClosureEventMonitorC31requestDidParseDownloadResponseyAA0H7RequestC_AA0hI0Vy10Foundation3URLVSgAA7AFErrorOGtcSgvp) `
Closure called on the `[request(_:didParseResponse:)](../Classes/ClosureEventMonitor.html#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA11DataRequestC_AA0hG0Vy10Foundation0H0VSgAA7AFErrorOGtF) ` event.
#### Declaration
* `[queue](#/s:9Alamofire12EventMonitorP5queueSo012OS_dispatch_D0Cvp) `
#### Declaration
* `[init(queue:)](#/s:9Alamofire19ClosureEventMonitorC5queueACSo012OS_dispatch_E0C_tcfc) `
Creates an instance using the provided queue.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | `DispatchQueue` on which events will fired. `.main` by default. |
* `[urlSession(_:didBecomeInvalidWithError:)](#/s:9Alamofire12EventMonitorP10urlSession_25didBecomeInvalidWithErrorySo12NSURLSessionC_s0J0_pSgtF) `
#### Declaration
* `[urlSession(_:task:didReceive:)](#/s:9Alamofire12EventMonitorP10urlSession_4task10didReceiveySo12NSURLSessionC_So0I4TaskCSo28NSURLAuthenticationChallengeCtF) `
#### Declaration
* `[urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)](#/s:9Alamofire12EventMonitorP10urlSession_4task15didSendBodyData14totalBytesSent0kl10ExpectedToH0ySo12NSURLSessionC_So0P4TaskCs5Int64VA2NtF) `
#### Declaration
* `[urlSession(_:taskNeedsNewBodyStream:)](#/s:9Alamofire12EventMonitorP10urlSession_22taskNeedsNewBodyStreamySo12NSURLSessionC_So0K4TaskCtF) `
#### Declaration
* `[urlSession(_:task:willPerformHTTPRedirection:newRequest:)](#/s:9Alamofire12EventMonitorP10urlSession_4task26willPerformHTTPRedirection10newRequestySo12NSURLSessionC_So0L4TaskCSo17NSHTTPURLResponseC10Foundation10URLRequestVtF) `
#### Declaration
* `[urlSession(_:task:didFinishCollecting:)](#/s:9Alamofire12EventMonitorP10urlSession_4task19didFinishCollectingySo12NSURLSessionC_So0J4TaskCSo0jK7MetricsCtF) `
#### Declaration
* `[urlSession(_:task:didCompleteWithError:)](#/s:9Alamofire12EventMonitorP10urlSession_4task20didCompleteWithErrorySo12NSURLSessionC_So0K4TaskCs0J0_pSgtF) `
#### Declaration
* `[urlSession(_:taskIsWaitingForConnectivity:)](#/s:9Alamofire12EventMonitorP10urlSession_28taskIsWaitingForConnectivityySo12NSURLSessionC_So0K4TaskCtF) `
#### Declaration
* `[urlSession(_:dataTask:didReceive:)](#/s:9Alamofire12EventMonitorP10urlSession_8dataTask10didReceiveySo12NSURLSessionC_So0j4DataG0CSo13NSURLResponseCtF) `
#### Declaration
* `[urlSession(_:dataTask:didReceive:)](#/s:9Alamofire12EventMonitorP10urlSession_8dataTask10didReceiveySo12NSURLSessionC_So0j4DataG0C10Foundation0K0VtF) `
#### Declaration
* `[urlSession(_:dataTask:willCacheResponse:)](#/s:9Alamofire12EventMonitorP10urlSession_8dataTask17willCacheResponseySo12NSURLSessionC_So0k4DataG0CSo19NSCachedURLResponseCtF) `
#### Declaration
* `[urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)](#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask17didResumeAtOffset18expectedTotalBytesySo12NSURLSessionC_So0o8DownloadG0Cs5Int64VAMtF) `
#### Declaration
* `[urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)](#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask12didWriteData17totalBytesWritten0kl10ExpectedToI0ySo12NSURLSessionC_So0p8DownloadG0Cs5Int64VA2NtF) `
#### Declaration
* `[urlSession(_:downloadTask:didFinishDownloadingTo:)](#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask22didFinishDownloadingToySo12NSURLSessionC_So0l8DownloadG0C10Foundation3URLVtF) `
#### Declaration
* `[request(_:didCreateInitialURLRequest:)](#/s:9Alamofire12EventMonitorP7request_26didCreateInitialURLRequestyAA7RequestC_10Foundation0H0VtF) `
#### Declaration
* `[request(_:didFailToCreateURLRequestWithError:)](#/s:9Alamofire12EventMonitorP7request_34didFailToCreateURLRequestWithErroryAA7RequestC_AA7AFErrorOtF) `
#### Declaration
* `[request(_:didAdaptInitialRequest:to:)](#/s:9Alamofire12EventMonitorP7request_22didAdaptInitialRequest2toyAA0H0C_10Foundation10URLRequestVAKtF) `
#### Declaration
* `[request(_:didFailToAdaptURLRequest:withError:)](#/s:9Alamofire12EventMonitorP7request_24didFailToAdaptURLRequest9withErroryAA7RequestC_10Foundation0I0VAA7AFErrorOtF) `
#### Declaration
* `[request(_:didCreateURLRequest:)](#/s:9Alamofire12EventMonitorP7request_19didCreateURLRequestyAA7RequestC_10Foundation0G0VtF) `
#### Declaration
* `[request(_:didCreateTask:)](#/s:9Alamofire12EventMonitorP7request_13didCreateTaskyAA7RequestC_So012NSURLSessionG0CtF) `
#### Declaration
* `[request(_:didGatherMetrics:)](#/s:9Alamofire12EventMonitorP7request_16didGatherMetricsyAA7RequestC_So016NSURLSessionTaskG0CtF) `
#### Declaration
* `[request(_:didFailTask:earlyWithError:)](#/s:9Alamofire12EventMonitorP7request_11didFailTask14earlyWithErroryAA7RequestC_So012NSURLSessionG0CAA7AFErrorOtF) `
#### Declaration
* `[request(_:didCompleteTask:with:)](#/s:9Alamofire12EventMonitorP7request_15didCompleteTask4withyAA7RequestC_So012NSURLSessionG0CAA7AFErrorOSgtF) `
#### Declaration
* `[requestIsRetrying(_:)](#/s:9Alamofire12EventMonitorP17requestIsRetryingyyAA7RequestCF) `
#### Declaration
* `[requestDidFinish(_:)](#/s:9Alamofire12EventMonitorP16requestDidFinishyyAA7RequestCF) `
#### Declaration
* `[requestDidResume(_:)](#/s:9Alamofire12EventMonitorP16requestDidResumeyyAA7RequestCF) `
#### Declaration
* `[request(_:didResumeTask:)](#/s:9Alamofire12EventMonitorP7request_13didResumeTaskyAA7RequestC_So012NSURLSessionG0CtF) `
#### Declaration
* `[requestDidSuspend(_:)](#/s:9Alamofire12EventMonitorP17requestDidSuspendyyAA7RequestCF) `
#### Declaration
* `[request(_:didSuspendTask:)](#/s:9Alamofire12EventMonitorP7request_14didSuspendTaskyAA7RequestC_So012NSURLSessionG0CtF) `
#### Declaration
* `[requestDidCancel(_:)](#/s:9Alamofire12EventMonitorP16requestDidCancelyyAA7RequestCF) `
#### Declaration
* `[request(_:didCancelTask:)](#/s:9Alamofire12EventMonitorP7request_13didCancelTaskyAA7RequestC_So012NSURLSessionG0CtF) `
#### Declaration
* `[request(_:didValidateRequest:response:data:withResult:)](#/s:9Alamofire12EventMonitorP7request_18didValidateRequest8response4data10withResultyAA04DataG0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCAK0L0VSgs0K0Oyyts5Error_pGtF) `
#### Declaration
* `[request(_:didParseResponse:)](#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA11DataRequestC_AA0hG0Vy10Foundation0H0VSgAA7AFErrorOGtF) `
#### Declaration
* `[request(_:didValidateRequest:response:withResult:)](#/s:9Alamofire12EventMonitorP7request_18didValidateRequest8response10withResultyAA010DataStreamG0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCs0J0Oyyts5Error_pGtF) `
#### Declaration
* `[request(_:didCreateUploadable:)](#/s:9Alamofire12EventMonitorP7request_19didCreateUploadableyAA13UploadRequestC_AG0G0OtF) `
#### Declaration
* `[request(_:didFailToCreateUploadableWithError:)](#/s:9Alamofire12EventMonitorP7request_34didFailToCreateUploadableWithErroryAA13UploadRequestC_AA7AFErrorOtF) `
#### Declaration
* `[request(_:didProvideInputStream:)](#/s:9Alamofire12EventMonitorP7request_21didProvideInputStreamyAA13UploadRequestC_So07NSInputH0CtF) `
#### Declaration
* `[request(_:didFinishDownloadingUsing:with:)](#/s:9Alamofire12EventMonitorP7request_25didFinishDownloadingUsing4withyAA15DownloadRequestC_So16NSURLSessionTaskCs6ResultOy10Foundation3URLVAA7AFErrorOGtF) `
#### Declaration
* `[request(_:didCreateDestinationURL:)](#/s:9Alamofire12EventMonitorP7request_23didCreateDestinationURLyAA15DownloadRequestC_10Foundation0H0VtF) `
#### Declaration
* `[request(_:didValidateRequest:response:fileURL:withResult:)](#/s:9Alamofire12EventMonitorP7request_18didValidateRequest8response7fileURL10withResultyAA08DownloadG0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCAK0J0VSgs0L0Oyyts5Error_pGtF) `
#### Declaration
* `[request(_:didParseResponse:)](#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA15DownloadRequestC_AA0hG0Vy10Foundation3URLVSgAA7AFErrorOGtF) `
#### Declaration
---
# ConnectionLostRetryPolicy Class Reference
ConnectionLostRetryPolicy
=========================
A retry policy that automatically retries idempotent requests for network connection lost errors. For more information about retrying network connection lost errors, please refer to Apple’s [technical document](https://developer.apple.com/library/content/qa/qa1941/_index.html)
.
* `[init(retryLimit:exponentialBackoffBase:exponentialBackoffScale:retryableHTTPMethods:)](#/s:9Alamofire25ConnectionLostRetryPolicyC10retryLimit22exponentialBackoffBase0hI5Scale20retryableHTTPMethodsACSu_SuSdShyAA10HTTPMethodVGtcfc) `
Creates a `ConnectionLostRetryPolicy` instance from the specified parameters.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_retryLimit_` | The total number of times the request is allowed to be retried. `[RetryPolicy.defaultRetryLimit](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC07defaultB5LimitSuvpZ) ` by default. |
| `_exponentialBackoffBase_` | The base of the exponential backoff policy. `[RetryPolicy.defaultExponentialBackoffBase](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC29defaultExponentialBackoffBaseSuvpZ) ` by default. |
| `_exponentialBackoffScale_` | The scale of the exponential backoff. `[RetryPolicy.defaultExponentialBackoffScale](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC30defaultExponentialBackoffScaleSdvpZ) ` by default. |
| `_retryableHTTPMethods_` | The idempotent http methods to retry. `[RetryPolicy.defaultRetryableHTTPMethods](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC27defaultRetryableHTTPMethodsShyAA10HTTPMethodVGvpZ) ` by default. |
---
# DataResponseSerializer Class Reference
DataResponseSerializer
======================
A `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` that performs minimal response checking and returns any response `Data` as-is. By default, a request returning `nil` or no data is considered an error. However, if the request has an `[HTTPMethod](../Structs/HTTPMethod.html) ` or the response has an HTTP status code valid for empty responses, then an empty `Data` value is returned.
* `[dataPreprocessor](#/s:9Alamofire18ResponseSerializerP16dataPreprocessorAA04DataE0_pvp) `
#### Declaration
* `[emptyResponseCodes](#/s:9Alamofire18ResponseSerializerP05emptyB5CodesShySiGvp) `
#### Declaration
* `[emptyRequestMethods](#/s:9Alamofire18ResponseSerializerP19emptyRequestMethodsShyAA10HTTPMethodVGvp) `
#### Declaration
* `[init(dataPreprocessor:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire22DataResponseSerializerC16dataPreprocessor05emptyC5Codes0G14RequestMethodsAcA0bF0_p_ShySiGShyAA10HTTPMethodVGtcfc) `
Creates a `DataResponseSerializer` using the provided parameters.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` used to prepare the received `Data` for serialization. |
| `_emptyResponseCodes_` | The HTTP response codes for which empty responses are allowed. `[204, 205]` by default. |
| `_emptyRequestMethods_` | The HTTP request methods for which empty responses are allowed. `[.head]` by default. |
* `[serialize(request:response:data:error:)](#/s:9Alamofire30DataResponseSerializerProtocolP9serialize7request8response4data5error16SerializedObjectQz10Foundation10URLRequestVSg_So17NSHTTPURLResponseCSgAK0B0VSgs5Error_pSgtKF) `
#### Declaration
---
# CompositeEventMonitor Class Reference
CompositeEventMonitor
=====================
An `[EventMonitor](../Protocols/EventMonitor.html) ` which can contain multiple `[EventMonitor](../Protocols/EventMonitor.html) `s and calls their methods on their queues.
* `[queue](#/s:9Alamofire12EventMonitorP5queueSo012OS_dispatch_D0Cvp) `
#### Declaration
* `[urlSession(_:didBecomeInvalidWithError:)](#/s:9Alamofire12EventMonitorP10urlSession_25didBecomeInvalidWithErrorySo12NSURLSessionC_s0J0_pSgtF) `
#### Declaration
* `[urlSession(_:task:didReceive:)](#/s:9Alamofire12EventMonitorP10urlSession_4task10didReceiveySo12NSURLSessionC_So0I4TaskCSo28NSURLAuthenticationChallengeCtF) `
#### Declaration
* `[urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)](#/s:9Alamofire12EventMonitorP10urlSession_4task15didSendBodyData14totalBytesSent0kl10ExpectedToH0ySo12NSURLSessionC_So0P4TaskCs5Int64VA2NtF) `
#### Declaration
* `[urlSession(_:taskNeedsNewBodyStream:)](#/s:9Alamofire12EventMonitorP10urlSession_22taskNeedsNewBodyStreamySo12NSURLSessionC_So0K4TaskCtF) `
#### Declaration
* `[urlSession(_:task:willPerformHTTPRedirection:newRequest:)](#/s:9Alamofire12EventMonitorP10urlSession_4task26willPerformHTTPRedirection10newRequestySo12NSURLSessionC_So0L4TaskCSo17NSHTTPURLResponseC10Foundation10URLRequestVtF) `
#### Declaration
* `[urlSession(_:task:didFinishCollecting:)](#/s:9Alamofire12EventMonitorP10urlSession_4task19didFinishCollectingySo12NSURLSessionC_So0J4TaskCSo0jK7MetricsCtF) `
#### Declaration
* `[urlSession(_:task:didCompleteWithError:)](#/s:9Alamofire12EventMonitorP10urlSession_4task20didCompleteWithErrorySo12NSURLSessionC_So0K4TaskCs0J0_pSgtF) `
#### Declaration
* `[urlSession(_:taskIsWaitingForConnectivity:)](#/s:9Alamofire12EventMonitorP10urlSession_28taskIsWaitingForConnectivityySo12NSURLSessionC_So0K4TaskCtF) `
#### Declaration
* `[urlSession(_:dataTask:didReceive:)](#/s:9Alamofire12EventMonitorP10urlSession_8dataTask10didReceiveySo12NSURLSessionC_So0j4DataG0CSo13NSURLResponseCtF) `
#### Declaration
* `[urlSession(_:dataTask:didReceive:)](#/s:9Alamofire12EventMonitorP10urlSession_8dataTask10didReceiveySo12NSURLSessionC_So0j4DataG0C10Foundation0K0VtF) `
#### Declaration
* `[urlSession(_:dataTask:willCacheResponse:)](#/s:9Alamofire12EventMonitorP10urlSession_8dataTask17willCacheResponseySo12NSURLSessionC_So0k4DataG0CSo19NSCachedURLResponseCtF) `
#### Declaration
* `[urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)](#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask17didResumeAtOffset18expectedTotalBytesySo12NSURLSessionC_So0o8DownloadG0Cs5Int64VAMtF) `
#### Declaration
* `[urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)](#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask12didWriteData17totalBytesWritten0kl10ExpectedToI0ySo12NSURLSessionC_So0p8DownloadG0Cs5Int64VA2NtF) `
#### Declaration
* `[urlSession(_:downloadTask:didFinishDownloadingTo:)](#/s:9Alamofire12EventMonitorP10urlSession_12downloadTask22didFinishDownloadingToySo12NSURLSessionC_So0l8DownloadG0C10Foundation3URLVtF) `
#### Declaration
* `[request(_:didCreateInitialURLRequest:)](#/s:9Alamofire12EventMonitorP7request_26didCreateInitialURLRequestyAA7RequestC_10Foundation0H0VtF) `
#### Declaration
* `[request(_:didFailToCreateURLRequestWithError:)](#/s:9Alamofire12EventMonitorP7request_34didFailToCreateURLRequestWithErroryAA7RequestC_AA7AFErrorOtF) `
#### Declaration
* `[request(_:didAdaptInitialRequest:to:)](#/s:9Alamofire12EventMonitorP7request_22didAdaptInitialRequest2toyAA0H0C_10Foundation10URLRequestVAKtF) `
#### Declaration
* `[request(_:didFailToAdaptURLRequest:withError:)](#/s:9Alamofire12EventMonitorP7request_24didFailToAdaptURLRequest9withErroryAA7RequestC_10Foundation0I0VAA7AFErrorOtF) `
#### Declaration
* `[request(_:didCreateURLRequest:)](#/s:9Alamofire12EventMonitorP7request_19didCreateURLRequestyAA7RequestC_10Foundation0G0VtF) `
#### Declaration
* `[request(_:didCreateTask:)](#/s:9Alamofire12EventMonitorP7request_13didCreateTaskyAA7RequestC_So012NSURLSessionG0CtF) `
#### Declaration
* `[request(_:didGatherMetrics:)](#/s:9Alamofire12EventMonitorP7request_16didGatherMetricsyAA7RequestC_So016NSURLSessionTaskG0CtF) `
#### Declaration
* `[request(_:didFailTask:earlyWithError:)](#/s:9Alamofire12EventMonitorP7request_11didFailTask14earlyWithErroryAA7RequestC_So012NSURLSessionG0CAA7AFErrorOtF) `
#### Declaration
* `[request(_:didCompleteTask:with:)](#/s:9Alamofire12EventMonitorP7request_15didCompleteTask4withyAA7RequestC_So012NSURLSessionG0CAA7AFErrorOSgtF) `
#### Declaration
* `[requestIsRetrying(_:)](#/s:9Alamofire12EventMonitorP17requestIsRetryingyyAA7RequestCF) `
#### Declaration
* `[requestDidFinish(_:)](#/s:9Alamofire12EventMonitorP16requestDidFinishyyAA7RequestCF) `
#### Declaration
* `[requestDidResume(_:)](#/s:9Alamofire12EventMonitorP16requestDidResumeyyAA7RequestCF) `
#### Declaration
* `[request(_:didResumeTask:)](#/s:9Alamofire12EventMonitorP7request_13didResumeTaskyAA7RequestC_So012NSURLSessionG0CtF) `
#### Declaration
* `[requestDidSuspend(_:)](#/s:9Alamofire12EventMonitorP17requestDidSuspendyyAA7RequestCF) `
#### Declaration
* `[request(_:didSuspendTask:)](#/s:9Alamofire12EventMonitorP7request_14didSuspendTaskyAA7RequestC_So012NSURLSessionG0CtF) `
#### Declaration
* `[requestDidCancel(_:)](#/s:9Alamofire12EventMonitorP16requestDidCancelyyAA7RequestCF) `
#### Declaration
* `[request(_:didCancelTask:)](#/s:9Alamofire12EventMonitorP7request_13didCancelTaskyAA7RequestC_So012NSURLSessionG0CtF) `
#### Declaration
* `[request(_:didValidateRequest:response:data:withResult:)](#/s:9Alamofire12EventMonitorP7request_18didValidateRequest8response4data10withResultyAA04DataG0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCAK0L0VSgs0K0Oyyts5Error_pGtF) `
#### Declaration
* `[request(_:didParseResponse:)](#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA11DataRequestC_AA0hG0Vy10Foundation0H0VSgAA7AFErrorOGtF) `
#### Declaration
* `[request(_:didParseResponse:)](#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA11DataRequestC_AA0hG0Vyqd__AA7AFErrorOGts8SendableRd__lF) `
#### Declaration
* `[request(_:didValidateRequest:response:withResult:)](#/s:9Alamofire12EventMonitorP7request_18didValidateRequest8response10withResultyAA010DataStreamG0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCs0J0Oyyts5Error_pGtF) `
#### Declaration
* `[request(_:didParseStream:)](#/s:9Alamofire12EventMonitorP7request_14didParseStreamyAA04DataG7RequestC_s6ResultOyqd__AA7AFErrorOGts8SendableRd__lF) `
#### Declaration
* `[request(_:didCreateUploadable:)](#/s:9Alamofire12EventMonitorP7request_19didCreateUploadableyAA13UploadRequestC_AG0G0OtF) `
#### Declaration
* `[request(_:didFailToCreateUploadableWithError:)](#/s:9Alamofire12EventMonitorP7request_34didFailToCreateUploadableWithErroryAA13UploadRequestC_AA7AFErrorOtF) `
#### Declaration
* `[request(_:didProvideInputStream:)](#/s:9Alamofire12EventMonitorP7request_21didProvideInputStreamyAA13UploadRequestC_So07NSInputH0CtF) `
#### Declaration
* `[request(_:didFinishDownloadingUsing:with:)](#/s:9Alamofire12EventMonitorP7request_25didFinishDownloadingUsing4withyAA15DownloadRequestC_So16NSURLSessionTaskCs6ResultOy10Foundation3URLVAA7AFErrorOGtF) `
#### Declaration
* `[request(_:didCreateDestinationURL:)](#/s:9Alamofire12EventMonitorP7request_23didCreateDestinationURLyAA15DownloadRequestC_10Foundation0H0VtF) `
#### Declaration
* `[request(_:didValidateRequest:response:fileURL:withResult:)](#/s:9Alamofire12EventMonitorP7request_18didValidateRequest8response7fileURL10withResultyAA08DownloadG0C_10Foundation10URLRequestVSgSo17NSHTTPURLResponseCAK0J0VSgs0L0Oyyts5Error_pGtF) `
#### Declaration
* `[request(_:didParseResponse:)](#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA15DownloadRequestC_AA0hG0Vy10Foundation3URLVSgAA7AFErrorOGtF) `
#### Declaration
* `[request(_:didParseResponse:)](#/s:9Alamofire12EventMonitorP7request_16didParseResponseyAA15DownloadRequestC_AA0hG0Vyqd__AA7AFErrorOGts8SendableRd__lF) `
#### Declaration
---
# Stream Structure Reference
Stream
======
Type encapsulating an `[Event](../../Classes/DataStreamRequest/Event.html) ` as it flows through the stream, as well as a `[CancellationToken](../../Classes/DataStreamRequest/CancellationToken.html) ` which can be used to stop the stream at any time.
* `[event](#/s:9Alamofire17DataStreamRequestC0C0V5eventAC5EventOy_xq_Gvp) `
Latest `[Event](../../Classes/DataStreamRequest/Event.html) ` from the stream.
#### Declaration
* `[token](#/s:9Alamofire17DataStreamRequestC0C0V5tokenAC17CancellationTokenVvp) `
Token used to cancel the stream.
#### Declaration
* `[cancel()](#/s:9Alamofire17DataStreamRequestC0C0V6cancelyyF) `
Cancel the ongoing stream by canceling the underlying `[DataStreamRequest](../../Classes/DataStreamRequest.html) `.
#### Declaration
* `[result](#/s:9Alamofire17DataStreamRequestC0C0V6results6ResultOyxq_GSgvp) `
Incoming `Result` values from `Event.stream`.
#### Declaration
* `[value](#/s:9Alamofire17DataStreamRequestC0C0V5valuexSgvp) `
`Success` value of the instance, if any.
#### Declaration
* `[error](#/s:9Alamofire17DataStreamRequestC0C0V5errorq_Sgvp) `
`Failure` value of the instance, if any.
#### Declaration
* `[completion](#/s:9Alamofire17DataStreamRequestC0C0V10completionAC10CompletionVSgvp) `
`[Completion](../../Classes/DataStreamRequest/Completion.html) ` value of the instance, if any.
#### Declaration
---
# DataStreamRequest Class Reference
DataStreamRequest
=================
`[Request](../Classes/Request.html) ` subclass which streams HTTP response `Data` through a `Handler` closure.
* `[Handler](#/s:9Alamofire17DataStreamRequestC7Handlera) `
Closure type handling `[DataStreamRequest.Stream](../Classes/DataStreamRequest/Stream.html) ` values.
#### Declaration
* `[Stream](#/s:9Alamofire17DataStreamRequestC0C0V) `
Type encapsulating an `[Event](../Classes/DataStreamRequest/Event.html) ` as it flows through the stream, as well as a `[CancellationToken](../Classes/DataStreamRequest/CancellationToken.html) ` which can be used to stop the stream at any time.
[See more](../Classes/DataStreamRequest/Stream.html)
#### Declaration
* `[Event](#/s:9Alamofire17DataStreamRequestC5EventO) `
Type representing an event flowing through the stream. Contains either the `Result` of processing streamed `Data` or the completion of the stream.
[See more](../Classes/DataStreamRequest/Event.html)
#### Declaration
* `[Completion](#/s:9Alamofire17DataStreamRequestC10CompletionV) `
Value containing the state of a `[DataStreamRequest](../Classes/DataStreamRequest.html) ` when the stream was completed.
[See more](../Classes/DataStreamRequest/Completion.html)
#### Declaration
* `[CancellationToken](#/s:9Alamofire17DataStreamRequestC17CancellationTokenV) `
Type used to cancel an ongoing stream.
[See more](../Classes/DataStreamRequest/CancellationToken.html)
#### Declaration
* `[convertible](#/s:9Alamofire17DataStreamRequestC11convertibleAA21URLRequestConvertible_pvp) `
`[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value used to create `URLRequest`s for this instance.
#### Declaration
* `[automaticallyCancelOnStreamError](#/s:9Alamofire17DataStreamRequestC021automaticallyCancelOnC5ErrorSbvp) `
Whether or not the instance will be cancelled if stream parsing encounters an error.
#### Declaration
* `[validate(_:)](#/s:9Alamofire17DataStreamRequestC8validateyACXDs6ResultOyyts5Error_pG10Foundation10URLRequestVSg_So17NSHTTPURLResponseCtYbcF) `
Validates the `URLRequest` and `HTTPURLResponse` received for the instance using the provided `[Validation](../Classes/DataStreamRequest.html#/s:9Alamofire17DataStreamRequestC10Validationa) ` closure.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_validation_` | `[Validation](../Classes/DataStreamRequest.html#/s:9Alamofire17DataStreamRequestC10Validationa) ` closure used to validate the request and response. |
#### Return Value
The `DataStreamRequest`.
* `[asInputStream(bufferSize:)](#/s:9Alamofire17DataStreamRequestC07asInputC010bufferSizeSo07NSInputC0CSgSi_tF) `
Produces an `InputStream` that receives the `Data` received by the instance.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_bufferSize_` | Size, in bytes, of the buffer between the `OutputStream` and `InputStream`. |
#### Return Value
The `InputStream` bound to the internal `OutboundStream`.
* `[onHTTPResponse(on:perform:)](#/s:9Alamofire17DataStreamRequestC14onHTTPResponse0E07performACXDSo17OS_dispatch_queueC_ySo17NSHTTPURLResponseC_yAA0D0C19ResponseDispositionOctctF) `
Sets a closure called whenever the `[DataRequest](../Classes/DataRequest.html) ` produces an `HTTPURLResponse` and providing a completion handler to return a `ResponseDisposition` value.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | `DispatchQueue` on which the closure will be called. `.main` by default. |
| `_handler_` | Closure called when the instance produces an `HTTPURLResponse`. The `completionHandler` provided MUST be called, otherwise the request will never complete. |
#### Return Value
The instance.
* `[onHTTPResponse(on:perform:)](#/s:9Alamofire17DataStreamRequestC14onHTTPResponse0E07performACXDSo17OS_dispatch_queueC_ySo17NSHTTPURLResponseCctF) `
Sets a closure called whenever the `[DataRequest](../Classes/DataRequest.html) ` produces an `HTTPURLResponse`.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | `DispatchQueue` on which the closure will be called. `.main` by default. |
| `_handler_` | Closure called when the instance produces an `HTTPURLResponse`. |
#### Return Value
The instance.
[](#/Response%20Serialization)
### Response Serialization
* `[responseStream(on:stream:)](#/s:9Alamofire17DataStreamRequestC08responseC02on6streamACXDSo17OS_dispatch_queueC_yAC0C0Vy_10Foundation0B0Vs5NeverOGKctF) `
Adds a `StreamHandler` which performs no parsing on incoming `Data`.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | `DispatchQueue` on which to perform `StreamHandler` closure. |
| `_stream_` | `StreamHandler` closure called as `Data` is received. May be called multiple times. |
#### Return Value
The `DataStreamRequest`.
* `[responseStream(using:on:stream:)](#/s:9Alamofire17DataStreamRequestC08responseC05using2on6streamACXDx_So17OS_dispatch_queueCyAC0C0Vy_16SerializedObjectQzAA7AFErrorOGKctAA0bC10SerializerRzlF) `
Adds a `StreamHandler` which uses the provided `[DataStreamSerializer](../Protocols/DataStreamSerializer.html) ` to process incoming `Data`.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_serializer_` | `[DataStreamSerializer](../Protocols/DataStreamSerializer.html) ` used to process incoming `Data`. Its work is done on the `serializationQueue`. |
| `_queue_` | `DispatchQueue` on which to perform `StreamHandler` closure. |
| `_stream_` | `StreamHandler` closure called as `Data` is received. May be called multiple times. |
#### Return Value
The `DataStreamRequest`.
* `[responseStreamString(on:stream:)](#/s:9Alamofire17DataStreamRequestC08responseC6String2on6streamACXDSo17OS_dispatch_queueC_yAC0C0Vy_SSs5NeverOGKctF) `
Adds a `StreamHandler` which parses incoming `Data` as a UTF8 `String`.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | `DispatchQueue` on which to perform `StreamHandler` closure. |
| `_stream_` | `StreamHandler` closure called as `Data` is received. May be called multiple times. |
#### Return Value
The `DataStreamRequest`.
* `[responseStreamDecodable(of:on:using:preprocessor:stream:)](#/s:9Alamofire17DataStreamRequestC08responseC9Decodable2of2on5using12preprocessor6streamACXDxm_So17OS_dispatch_queueCAA0B7Decoder_pAA0B12Preprocessor_pyAC0C0Vy_xAA7AFErrorOGKctSeRzlF) `
Adds a `StreamHandler` which parses incoming `Data` using the provided `[DataDecoder](../Protocols/DataDecoder.html) `.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_type_` | `Decodable` type to parse incoming `Data` into. |
| `_queue_` | `DispatchQueue` on which to perform `StreamHandler` closure. |
| `_decoder_` | `[DataDecoder](../Protocols/DataDecoder.html) ` used to decode the incoming `Data`. |
| `_preprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` used to process the incoming `Data` before it’s passed to the `decoder`. |
| `_stream_` | `StreamHandler` closure called as `Data` is received. May be called multiple times. |
#### Return Value
The `DataStreamRequest`.
[](#/DataRequest%20%2F%20UploadRequest)
### DataRequest / UploadRequest
* `[publishStream(using:on:)](#/s:9Alamofire17DataStreamRequestC07publishC05using2onAA0bC9PublisherVy16SerializedObjectQzGx_So17OS_dispatch_queueCtAA0bC10SerializerRzlF) `
Creates a `[DataStreamPublisher](../Structs/DataStreamPublisher.html) ` for this instance using the given `[DataStreamSerializer](../Protocols/DataStreamSerializer.html) ` and `DispatchQueue`.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_serializer_` | `[DataStreamSerializer](../Protocols/DataStreamSerializer.html) ` used to serialize the streamed `Data`. |
| `_queue_` | `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default. |
#### Return Value
The `[DataStreamPublisher](../Structs/DataStreamPublisher.html) `.
* `[publishData(queue:)](#/s:9Alamofire17DataStreamRequestC07publishB05queueAA0bC9PublisherVy10Foundation0B0VGSo012OS_dispatch_F0C_tF) `
Creates a `[DataStreamPublisher](../Structs/DataStreamPublisher.html) ` for this instance which uses a `[PassthroughStreamSerializer](../Structs/PassthroughStreamSerializer.html) ` to stream `Data` unserialized.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default. |
#### Return Value
The `[DataStreamPublisher](../Structs/DataStreamPublisher.html) `.
* `[publishString(queue:)](#/s:9Alamofire17DataStreamRequestC13publishString5queueAA0bC9PublisherVySSGSo012OS_dispatch_G0C_tF) `
Creates a `[DataStreamPublisher](../Structs/DataStreamPublisher.html) ` for this instance which uses a `[StringStreamSerializer](../Structs/StringStreamSerializer.html) ` to serialize stream `Data` values into `String` values.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default. |
#### Return Value
The `[DataStreamPublisher](../Structs/DataStreamPublisher.html) `.
* `[publishDecodable(type:queue:decoder:preprocessor:)](#/s:9Alamofire17DataStreamRequestC16publishDecodable4type5queue7decoder12preprocessorAA0bC9PublisherVyxGxm_So012OS_dispatch_H0CAA0B7Decoder_pAA0B12Preprocessor_ptSeRzs8SendableRzlF) `
Creates a `[DataStreamPublisher](../Structs/DataStreamPublisher.html) ` for this instance which uses a `[DecodableStreamSerializer](../Structs/DecodableStreamSerializer.html) ` with the provided parameters to serialize stream `Data` values into the provided type.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_type_` | `Decodable` type to which to decode stream `Data`. Inferred from the context by default. |
| `_queue_` | `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default. |
| `_decoder_` | `[DataDecoder](../Protocols/DataDecoder.html) ` instance used to decode stream `Data`. `JSONDecoder()` by default. |
| `_preprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which filters incoming stream `Data` before serialization. `PassthroughPreprocessor()` by default. |
#### Return Value
The `[DataStreamPublisher](../Structs/DataStreamPublisher.html) `.
[](#/DataStreamTask)
### DataStreamTask
* `[httpResponses(bufferingPolicy:)](#/s:9Alamofire17DataStreamRequestC13httpResponses15bufferingPolicyAA0C2OfVySo17NSHTTPURLResponseCGScS12ContinuationV09BufferingH0OyAI__G_tF) `
Creates a `[StreamOf](../Structs/StreamOf.html) ` for the instance’s responses.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_bufferingPolicy_` | `BufferingPolicy` that determines the stream’s buffering behavior.`.unbounded` by default. |
#### Return Value
The `[StreamOf](../Structs/StreamOf.html) `.
* `[onHTTPResponse(perform:)](#/s:9Alamofire17DataStreamRequestC14onHTTPResponse7performACXDAA0D0C19ResponseDispositionOSo17NSHTTPURLResponseCYaYbc_tF) `
Sets an async closure returning a `[Request.ResponseDisposition](../Classes/Request/ResponseDisposition.html) `, called whenever the `DataStreamRequest` produces an `HTTPURLResponse`.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_handler_` | Async closure executed when a new `HTTPURLResponse` is received and returning a `ResponseDisposition` value. This value determines whether to continue the request or cancel it as if `cancel()` had been called on the instance. Note, this closure is called on an arbitrary thread, so any synchronous calls in it will execute in that context. |
#### Return Value
The instance.
* `[onHTTPResponse(perform:)](#/s:9Alamofire17DataStreamRequestC14onHTTPResponse7performACXDySo17NSHTTPURLResponseCYaYbc_tF) `
Sets an async closure called whenever the `DataStreamRequest` produces an `HTTPURLResponse`.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_handler_` | Async closure executed when a new `HTTPURLResponse` is received. Note, this closure is called on an arbitrary thread, so any synchronous calls in it will execute in that context. |
#### Return Value
The instance.
* `[streamTask()](#/s:9Alamofire17DataStreamRequestC10streamTaskAA0bcF0VyF) `
Creates a `[DataStreamTask](../Structs/DataStreamTask.html) ` used to `await` streams of serialized values.
#### Declaration
#### Return Value
The `[DataStreamTask](../Structs/DataStreamTask.html) `.
* `[Validation](#/s:9Alamofire17DataStreamRequestC10Validationa) `
A closure used to validate a request that takes a `URLRequest` and `HTTPURLResponse` and returns whether the request was valid.
#### Declaration
* `[validate(statusCode:)](#/s:9Alamofire17DataStreamRequestC8validate10statusCodeACXDx_tSTRzSi7ElementRtzlF) `
Validates that the response has a status code in the specified sequence.
If validation fails, subsequent calls to response handlers will have an associated error.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_acceptableStatusCodes_` | `Sequence` of acceptable response status codes. |
#### Return Value
The instance.
* `[validate(contentType:)](#/s:9Alamofire17DataStreamRequestC8validate11contentTypeACXDxyXA_tSTRzSS7ElementRtzlF) `
Validates that the response has a content type in the specified sequence.
If validation fails, subsequent calls to response handlers will have an associated error.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_contentType_` | The acceptable content types, which may specify wildcard types and/or subtypes. |
#### Return Value
The request.
* `[validate()](#/s:9Alamofire17DataStreamRequestC8validateACXDyF) `
Validates that the response has a status code in the default acceptable range of 200…299, and that the content type matches any specified in the Accept HTTP header field.
If validation fails, subsequent calls to response handlers will have an associated error.
#### Declaration
#### Return Value
The instance.
---
# Completion Structure Reference
Completion
==========
Value containing the state of a `[DataStreamRequest](../../Classes/DataStreamRequest.html) ` when the stream was completed.
* `[request](#/s:9Alamofire17DataStreamRequestC10CompletionV7request10Foundation10URLRequestVSgvp) `
Last `URLRequest` issued by the instance.
#### Declaration
* `[response](#/s:9Alamofire17DataStreamRequestC10CompletionV8responseSo17NSHTTPURLResponseCSgvp) `
Last `HTTPURLResponse` received by the instance.
#### Declaration
* `[metrics](#/s:9Alamofire17DataStreamRequestC10CompletionV7metricsSo23NSURLSessionTaskMetricsCSgvp) `
Last `URLSessionTaskMetrics` produced for the instance.
#### Declaration
* `[error](#/s:9Alamofire17DataStreamRequestC10CompletionV5errorAA7AFErrorOSgvp) `
`[AFError](../../Enums/AFError.html) ` produced for the instance, if any.
#### Declaration
---
# Event Enumeration Reference
Event
=====
Type representing an event flowing through the stream. Contains either the `Result` of processing streamed `Data` or the completion of the stream.
* `[stream(_:)](#/s:9Alamofire17DataStreamRequestC5EventO6streamyAEy_xq_Gs6ResultOyxq_GcAGms8SendableRzs5ErrorR_r0_lF) `
Output produced every time the instance receives additional `Data`. The associated value contains the `Result` of processing the incoming `Data`.
#### Declaration
* `[complete(_:)](#/s:9Alamofire17DataStreamRequestC5EventO8completeyAEy_xq_GAC10CompletionVcAGms8SendableRzs5ErrorR_r0_lF) `
Output produced when the instance has completed, whether due to stream end, cancellation, or an error. Associated `[Completion](../../Classes/DataStreamRequest/Completion.html) ` value contains the final state.
#### Declaration
---
# CancellationToken Structure Reference
CancellationToken
=================
Type used to cancel an ongoing stream.
* `[cancel()](#/s:9Alamofire17DataStreamRequestC17CancellationTokenV6cancelyyF) `
Cancel the ongoing stream by canceling the underlying `[DataStreamRequest](../../Classes/DataStreamRequest.html) `.
#### Declaration
---
# DataRequest Class Reference
DataRequest
===========
`[Request](../Classes/Request.html) ` subclass which handles in-memory `Data` download using `URLSessionDataTask`.
* `[convertible](#/s:9Alamofire11DataRequestC11convertibleAA21URLRequestConvertible_pvp) `
`[URLRequestConvertible](../Protocols/URLRequestConvertible.html) ` value used to create `URLRequest`s for this instance.
#### Declaration
* `[data](#/s:9Alamofire11DataRequestC4data10Foundation0B0VSgvp) `
`Data` read from the server so far.
#### Declaration
* `[validate(_:)](#/s:9Alamofire11DataRequestC8validateyACXDs6ResultOyyts5Error_pG10Foundation10URLRequestVSg_So17NSHTTPURLResponseCAI0B0VSgtcF) `
Validates the request, using the specified closure.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_validation_` | `[Validation](../Classes/DataRequest.html#/s:9Alamofire11DataRequestC10Validationa) ` closure used to validate the response. |
#### Return Value
The instance.
* `[onHTTPResponse(on:perform:)](#/s:9Alamofire11DataRequestC14onHTTPResponse0D07performACXDSo17OS_dispatch_queueC_ySo17NSHTTPURLResponseC_yAA0C0C19ResponseDispositionOctctF) `
Sets a closure called whenever the `DataRequest` produces an `HTTPURLResponse` and providing a completion handler to return a `ResponseDisposition` value.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | `DispatchQueue` on which the closure will be called. `.main` by default. |
| `_handler_` | Closure called when the instance produces an `HTTPURLResponse`. The `completionHandler` provided MUST be called, otherwise the request will never complete. |
#### Return Value
The instance.
* `[onHTTPResponse(on:perform:)](#/s:9Alamofire11DataRequestC14onHTTPResponse0D07performACXDSo17OS_dispatch_queueC_ySo17NSHTTPURLResponseCctF) `
Sets a closure called whenever the `DataRequest` produces an `HTTPURLResponse`.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | `DispatchQueue` on which the closure will be called. `.main` by default. |
| `_handler_` | Closure called when the instance produces an `HTTPURLResponse`. |
#### Return Value
The instance.
[](#/Response%20Serialization)
### Response Serialization
* `[response(queue:completionHandler:)](#/s:9Alamofire11DataRequestC8response5queue17completionHandlerACXDSo012OS_dispatch_E0C_yAA0B8ResponseVy10Foundation0B0VSgAA7AFErrorOGctF) `
Adds a handler to be called once the request has finished.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. |
| `_completionHandler_` | The code to be executed once the request has finished. |
#### Return Value
The request.
* `[response(queue:responseSerializer:completionHandler:)](#/s:9Alamofire11DataRequestC8response5queue0D10Serializer17completionHandlerACXDSo012OS_dispatch_E0C_xyAA0B8ResponseVy16SerializedObjectQzAA7AFErrorOGctAA0bkF8ProtocolRzlF) `
Adds a handler to be called once the request has finished.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | The queue on which the completion handler is dispatched. `.main` by default |
| `_responseSerializer_` | The response serializer responsible for serializing the request, response, and data. |
| `_completionHandler_` | The code to be executed once the request has finished. |
#### Return Value
The request.
* `[response(queue:responseSerializer:completionHandler:)](#/s:9Alamofire11DataRequestC8response5queue0D10Serializer17completionHandlerACXDSo012OS_dispatch_E0C_xyAA0B8ResponseVy16SerializedObjectQzAA7AFErrorOGctAA0kF0RzlF) `
Adds a handler to be called once the request has finished.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | The queue on which the completion handler is dispatched. `.main` by default |
| `_responseSerializer_` | The response serializer responsible for serializing the request, response, and data. |
| `_completionHandler_` | The code to be executed once the request has finished. |
#### Return Value
The request.
* `[responseData(queue:dataPreprocessor:emptyResponseCodes:emptyRequestMethods:completionHandler:)](#/s:9Alamofire11DataRequestC08responseB05queue16dataPreprocessor18emptyResponseCodes0hC7Methods17completionHandlerACXDSo012OS_dispatch_E0C_AA0bG0_pShySiGShyAA10HTTPMethodVGyAA0bI0Vy10Foundation0B0VAA7AFErrorOGctF) `
Adds a handler using a `[DataResponseSerializer](../Classes/DataResponseSerializer.html) ` to be called once the request has finished.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | The queue on which the completion handler is called. `.main` by default. |
| `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the `completionHandler`. `PassthroughPreprocessor()` by default. |
| `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. |
| `_completionHandler_` | A closure to be executed once the request has finished. |
#### Return Value
The request.
* `[responseString(queue:dataPreprocessor:encoding:emptyResponseCodes:emptyRequestMethods:completionHandler:)](#/s:9Alamofire11DataRequestC14responseString5queue16dataPreprocessor8encoding18emptyResponseCodes0jC7Methods17completionHandlerACXDSo012OS_dispatch_F0C_AA0bH0_pSS10FoundationE8EncodingVSgShySiGShyAA10HTTPMethodVGyAA0bK0VySSAA7AFErrorOGctF) `
Adds a handler using a `[StringResponseSerializer](../Classes/StringResponseSerializer.html) ` to be called once the request has finished.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. |
| `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the `completionHandler`. `PassthroughPreprocessor()` by default. |
| `_encoding_` | The string encoding. Defaults to `nil`, in which case the encoding will be determined from the server response, falling back to the default HTTP character set, `ISO-8859-1`. |
| `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. |
| `_completionHandler_` | A closure to be executed once the request has finished. |
#### Return Value
The request.
* `[responseJSON(queue:dataPreprocessor:emptyResponseCodes:emptyRequestMethods:options:completionHandler:)](#/s:9Alamofire11DataRequestC12responseJSON5queue16dataPreprocessor18emptyResponseCodes0iC7Methods7options17completionHandlerACXDSo012OS_dispatch_F0C_AA0bH0_pShySiGShyAA10HTTPMethodVGSo20NSJSONReadingOptionsVyAA0bJ0VyypAA7AFErrorOGctF) `
Adds a handler using a `[JSONResponseSerializer](../Classes/JSONResponseSerializer.html) ` to be called once the request has finished.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. |
| `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the `completionHandler`. `PassthroughPreprocessor()` by default. |
| `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. |
| `_options_` | `JSONSerialization.ReadingOptions` used when parsing the response. `.allowFragments` by default. |
| `_completionHandler_` | A closure to be executed once the request has finished. |
#### Return Value
The request.
* `[responseDecodable(of:queue:dataPreprocessor:decoder:emptyResponseCodes:emptyRequestMethods:completionHandler:)](#/s:9Alamofire11DataRequestC17responseDecodable2of5queue16dataPreprocessor7decoder18emptyResponseCodes0kC7Methods17completionHandlerACXDxm_So012OS_dispatch_G0CAA0bI0_pAA0B7Decoder_pShySiGShyAA10HTTPMethodVGyAA0bL0VyxAA7AFErrorOGctSeRzlF) `
Adds a handler using a `[DecodableResponseSerializer](../Classes/DecodableResponseSerializer.html) ` to be called once the request has finished.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_type_` | `Decodable` type to decode from response data. |
| `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. |
| `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the `completionHandler`. `PassthroughPreprocessor()` by default. |
| `_decoder_` | `[DataDecoder](../Protocols/DataDecoder.html) ` to use to decode the response. `JSONDecoder()` by default. |
| `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. |
| `_completionHandler_` | A closure to be executed once the request has finished. |
#### Return Value
The request.
[](#/DataRequest%20%2F%20UploadRequest)
### DataRequest / UploadRequest
* `[publishResponse(using:on:)](#/s:9Alamofire11DataRequestC15publishResponse5using2onAA0bE9PublisherVyq_Gx_So17OS_dispatch_queueCtAA0E10SerializerRz16SerializedObjectQzRs_r0_lF) `
Creates a `[DataResponsePublisher](../Structs/DataResponsePublisher.html) ` for this instance using the given `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` and `DispatchQueue`.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_serializer_` | `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` used to serialize response `Data`. |
| `_queue_` | `DispatchQueue` on which the `[DataResponse](../Structs/DataResponse.html) ` will be published. `.main` by default. |
#### Return Value
The `[DataResponsePublisher](../Structs/DataResponsePublisher.html) `.
* `[publishData(queue:preprocessor:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire11DataRequestC07publishB05queue12preprocessor18emptyResponseCodes0gC7MethodsAA0bH9PublisherVy10Foundation0B0VGSo012OS_dispatch_E0C_AA0B12Preprocessor_pShySiGShyAA10HTTPMethodVGtF) `
Creates a `[DataResponsePublisher](../Structs/DataResponsePublisher.html) ` for this instance and uses a `[DataResponseSerializer](../Classes/DataResponseSerializer.html) ` to serialize the response.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | `DispatchQueue` on which the `[DataResponse](../Structs/DataResponse.html) ` will be published. `.main` by default. |
| `_preprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which filters the `Data` before serialization. `PassthroughPreprocessor()` by default. |
| `_emptyResponseCodes_` | `Set` of HTTP status codes for which empty responses are allowed. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `Set` of `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are allowed, regardless of status code. `[.head]` by default. |
#### Return Value
The `[DataResponsePublisher](../Structs/DataResponsePublisher.html) `.
* `[publishString(queue:preprocessor:encoding:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire11DataRequestC13publishString5queue12preprocessor8encoding18emptyResponseCodes0iC7MethodsAA0bJ9PublisherVySSGSo012OS_dispatch_F0C_AA0B12Preprocessor_pSS10FoundationE8EncodingVSgShySiGShyAA10HTTPMethodVGtF) `
Creates a `[DataResponsePublisher](../Structs/DataResponsePublisher.html) ` for this instance and uses a `[StringResponseSerializer](../Classes/StringResponseSerializer.html) ` to serialize the response.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | `DispatchQueue` on which the `[DataResponse](../Structs/DataResponse.html) ` will be published. `.main` by default. |
| `_preprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which filters the `Data` before serialization. `PassthroughPreprocessor()` by default. |
| `_encoding_` | `String.Encoding` to parse the response. `nil` by default, in which case the encoding will be determined by the server response, falling back to the default HTTP character set, `ISO-8859-1`. |
| `_emptyResponseCodes_` | `Set` of HTTP status codes for which empty responses are allowed. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `Set` of `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are allowed, regardless of status code. `[.head]` by default. |
#### Return Value
The `[DataResponsePublisher](../Structs/DataResponsePublisher.html) `.
* `[publishDecodable(type:queue:preprocessor:decoder:emptyResponseCodes:emptyResponseMethods:)](#/s:9Alamofire11DataRequestC16publishDecodable4type5queue12preprocessor7decoder18emptyResponseCodes0jK7MethodsAA0bK9PublisherVyxGxm_So012OS_dispatch_G0CAA0B12Preprocessor_pAA0B7Decoder_pShySiGShyAA10HTTPMethodVGtSeRzs8SendableRzlF) `
Undocumented
#### Declaration
* `[publishDecodable(type:queue:preprocessor:decoder:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire11DataRequestC16publishDecodable4type5queue12preprocessor7decoder18emptyResponseCodes0jC7MethodsAA0bK9PublisherVyxGxm_So012OS_dispatch_G0CAA0B12Preprocessor_pAA0B7Decoder_pShySiGShyAA10HTTPMethodVGtSeRzs8SendableRzlF) `
Creates a `[DataResponsePublisher](../Structs/DataResponsePublisher.html) ` for this instance and uses a `[DecodableResponseSerializer](../Classes/DecodableResponseSerializer.html) ` to serialize the response.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_type_` | `Decodable` type to which to decode response `Data`. Inferred from the context by default. |
| `_queue_` | `DispatchQueue` on which the `[DataResponse](../Structs/DataResponse.html) ` will be published. `.main` by default. |
| `_preprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which filters the `Data` before serialization. `PassthroughPreprocessor()` by default. |
| `_decoder_` | `[DataDecoder](../Protocols/DataDecoder.html) ` instance used to decode response `Data`. `JSONDecoder()` by default. |
| `_emptyResponseCodes_` | `Set` of HTTP status codes for which empty responses are allowed. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `Set` of `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are allowed, regardless of status code. `[.head]` by default. |
#### Return Value
The `[DataResponsePublisher](../Structs/DataResponsePublisher.html) `.
* `[publishUnserialized(queue:)](#/s:9Alamofire11DataRequestC19publishUnserialized5queueAA0B17ResponsePublisherVy10Foundation0B0VSgGSo012OS_dispatch_F0C_tF) `
Creates a `[DataResponsePublisher](../Structs/DataResponsePublisher.html) ` for this instance which does not serialize the response before publishing.
* queue: `DispatchQueue` on which the `[DataResponse](../Structs/DataResponse.html) ` will be published. `.main` by default.
#### Declaration
#### Return Value
The `[DataResponsePublisher](../Structs/DataResponsePublisher.html) `.
[](#/DataTask)
### DataTask
* `[httpResponses(bufferingPolicy:)](#/s:9Alamofire11DataRequestC13httpResponses15bufferingPolicyAA8StreamOfVySo17NSHTTPURLResponseCGScS12ContinuationV09BufferingG0OyAI__G_tF) `
Creates a `[StreamOf](../Structs/StreamOf.html) ` for the instance’s responses.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_bufferingPolicy_` | `BufferingPolicy` that determines the stream’s buffering behavior.`.unbounded` by default. |
#### Return Value
The `[StreamOf](../Structs/StreamOf.html) `.
* `[onHTTPResponse(perform:)](#/s:9Alamofire11DataRequestC14onHTTPResponse7performACXDAA0C0C19ResponseDispositionOSo17NSHTTPURLResponseCYaYbc_tF) `
Sets an async closure returning a `[Request.ResponseDisposition](../Classes/Request/ResponseDisposition.html) `, called whenever the `DataRequest` produces an `HTTPURLResponse`.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_handler_` | Async closure executed when a new `HTTPURLResponse` is received and returning a `ResponseDisposition` value. This value determines whether to continue the request or cancel it as if `cancel()` had been called on the instance. Note, this closure is called on an arbitrary thread, so any synchronous calls in it will execute in that context. |
#### Return Value
The instance.
* `[onHTTPResponse(perform:)](#/s:9Alamofire11DataRequestC14onHTTPResponse7performACXDySo17NSHTTPURLResponseCYaYbc_tF) `
Sets an async closure called whenever the `DataRequest` produces an `HTTPURLResponse`.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_handler_` | Async closure executed when a new `HTTPURLResponse` is received. Note, this closure is called on an arbitrary thread, so any synchronous calls in it will execute in that context. |
#### Return Value
The instance.
* `[serializingData(automaticallyCancelling:dataPreprocessor:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire11DataRequestC011serializingB023automaticallyCancelling16dataPreprocessor18emptyResponseCodes0iC7MethodsAA0B4TaskVy10Foundation0B0VGSb_AA0bH0_pShySiGShyAA10HTTPMethodVGtF) `
Creates a `[DataTask](../Structs/DataTask.html) ` to `await` a `Data` value.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DataTask](../Structs/DataTask.html) `‘s async properties. `true` by default. |
| `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before completion. |
| `_emptyResponseCodes_` | HTTP response codes for which empty responses are allowed. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. |
#### Return Value
The `[DataTask](../Structs/DataTask.html) `.
* `[serializingDecodable(_:automaticallyCancelling:dataPreprocessor:decoder:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire11DataRequestC20serializingDecodable_23automaticallyCancelling16dataPreprocessor7decoder18emptyResponseCodes0kC7MethodsAA0B4TaskVyxGxm_SbAA0bI0_pAA0B7Decoder_pShySiGShyAA10HTTPMethodVGtSeRzs8SendableRzlF) `
Creates a `[DataTask](../Structs/DataTask.html) ` to `await` serialization of a `Decodable` value.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_type_` | `Decodable` type to decode from response data. |
| `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DataTask](../Structs/DataTask.html) `‘s async properties. `true` by default. |
| `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the serializer. `PassthroughPreprocessor()` by default. |
| `_decoder_` | `[DataDecoder](../Protocols/DataDecoder.html) ` to use to decode the response. `JSONDecoder()` by default. |
| `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. |
#### Return Value
The `[DataTask](../Structs/DataTask.html) `.
* `[serializingString(automaticallyCancelling:dataPreprocessor:encoding:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire11DataRequestC17serializingString23automaticallyCancelling16dataPreprocessor8encoding18emptyResponseCodes0kC7MethodsAA0B4TaskVySSGSb_AA0bI0_pSS10FoundationE8EncodingVSgShySiGShyAA10HTTPMethodVGtF) `
Creates a `[DataTask](../Structs/DataTask.html) ` to `await` serialization of a `String` value.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DataTask](../Structs/DataTask.html) `‘s async properties. `true` by default. |
| `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the serializer. `PassthroughPreprocessor()` by default. |
| `_encoding_` | `String.Encoding` to use during serialization. Defaults to `nil`, in which case the encoding will be determined from the server response, falling back to the default HTTP character set, `ISO-8859-1`. |
| `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. |
#### Return Value
The `[DataTask](../Structs/DataTask.html) `.
* `[serializingResponse(using:automaticallyCancelling:)](#/s:9Alamofire11DataRequestC19serializingResponse5using23automaticallyCancellingAA0B4TaskVy16SerializedObjectQzGx_SbtAA0E10SerializerRzlF) `
Creates a `[DataTask](../Structs/DataTask.html) ` to `await` serialization using the provided `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` instance.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_serializer_` | `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` responsible for serializing the request, response, and data. |
| `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DataTask](../Structs/DataTask.html) `‘s async properties. `true` by default. |
#### Return Value
The `[DataTask](../Structs/DataTask.html) `.
* `[serializingResponse(using:automaticallyCancelling:)](#/s:9Alamofire11DataRequestC19serializingResponse5using23automaticallyCancellingAA0B4TaskVy16SerializedObjectQzGx_SbtAA0bE18SerializerProtocolRzlF) `
Creates a `[DataTask](../Structs/DataTask.html) ` to `await` serialization using the provided `[DataResponseSerializerProtocol](../Protocols/DataResponseSerializerProtocol.html) ` instance.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_serializer_` | `[DataResponseSerializerProtocol](../Protocols/DataResponseSerializerProtocol.html) ` responsible for serializing the request, response, and data. |
| `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DataTask](../Structs/DataTask.html) `‘s async properties. `true` by default. |
#### Return Value
The `[DataTask](../Structs/DataTask.html) `.
* `[Validation](#/s:9Alamofire11DataRequestC10Validationa) `
A closure used to validate a request that takes a URL request, a URL response and data, and returns whether the request was valid.
#### Declaration
* `[validate(statusCode:)](#/s:9Alamofire11DataRequestC8validate10statusCodeACXDx_tSTRzSi7ElementRtzlF) `
Validates that the response has a status code in the specified sequence.
If validation fails, subsequent calls to response handlers will have an associated error.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_acceptableStatusCodes_` | `Sequence` of acceptable response status codes. |
#### Return Value
The instance.
* `[validate(contentType:)](#/s:9Alamofire11DataRequestC8validate11contentTypeACXDxyXA_tSTRzSS7ElementRtzlF) `
Validates that the response has a content type in the specified sequence.
If validation fails, subsequent calls to response handlers will have an associated error.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_contentType_` | The acceptable content types, which may specify wildcard types and/or subtypes. |
#### Return Value
The request.
* `[validate()](#/s:9Alamofire11DataRequestC8validateACXDyF) `
Validates that the response has a status code in the default acceptable range of 200…299, and that the content type matches any specified in the Accept HTTP header field.
If validation fails, subsequent calls to response handlers will have an associated error.
#### Declaration
#### Return Value
The request.
---
# DecodableResponseSerializer Class Reference
DecodableResponseSerializer
===========================
A `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` that decodes the response data as a `Decodable` value using any decoder that conforms to `[DataDecoder](../Protocols/DataDecoder.html) `. By default, this is an instance of `JSONDecoder`.
* `[dataPreprocessor](#/s:9Alamofire18ResponseSerializerP16dataPreprocessorAA04DataE0_pvp) `
#### Declaration
* `[decoder](#/s:9Alamofire27DecodableResponseSerializerC7decoderAA11DataDecoder_pvp) `
The `[DataDecoder](../Protocols/DataDecoder.html) ` instance used to decode responses.
#### Declaration
* `[emptyResponseCodes](#/s:9Alamofire18ResponseSerializerP05emptyB5CodesShySiGvp) `
#### Declaration
* `[emptyRequestMethods](#/s:9Alamofire18ResponseSerializerP19emptyRequestMethodsShyAA10HTTPMethodVGvp) `
#### Declaration
* `[init(dataPreprocessor:decoder:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire27DecodableResponseSerializerC16dataPreprocessor7decoder05emptyC5Codes0H14RequestMethodsACyxGAA04DataF0_p_AA0L7Decoder_pShySiGShyAA10HTTPMethodVGtcfc) `
Creates an instance using the values provided.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` used to prepare the received `Data` for serialization. |
| `_decoder_` | The `[DataDecoder](../Protocols/DataDecoder.html) `. `JSONDecoder()` by default. |
| `_emptyResponseCodes_` | The HTTP response codes for which empty responses are allowed. `[204, 205]` by default. |
| `_emptyRequestMethods_` | The HTTP request methods for which empty responses are allowed. `[.head]` by default. |
* `[serialize(request:response:data:error:)](#/s:9Alamofire30DataResponseSerializerProtocolP9serialize7request8response4data5error16SerializedObjectQz10Foundation10URLRequestVSg_So17NSHTTPURLResponseCSgAK0B0VSgs5Error_pSgtKF) `
#### Declaration
---
# DefaultTrustEvaluator Class Reference
DefaultTrustEvaluator
=====================
An evaluator which uses the default server trust evaluation while allowing you to control whether to validate the host provided by the challenge. Applications are encouraged to always validate the host in production environments to guarantee the validity of the server’s certificate chain.
* `[init(validateHost:)](#/s:9Alamofire21DefaultTrustEvaluatorC12validateHostACSb_tcfc) `
Creates a `DefaultTrustEvaluator`.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_validateHost_` | Determines whether or not the evaluator should validate the host. `true` by default. |
* `[evaluate(_:forHost:)](#/s:9Alamofire21ServerTrustEvaluatingP8evaluate_7forHostySo03SecC3Refa_SStKF) `
#### Declaration
---
# DisabledTrustEvaluator Class Reference
DisabledTrustEvaluator
======================
Disables all evaluation which in turn will always consider any server trust as valid.
**THIS EVALUATOR SHOULD NEVER BE USED IN PRODUCTION!**
* `[init()](#/s:9Alamofire22DisabledTrustEvaluatorCACycfc) `
Creates an instance.
#### Declaration
* `[evaluate(_:forHost:)](#/s:9Alamofire21ServerTrustEvaluatingP8evaluate_7forHostySo03SecC3Refa_SStKF) `
#### Declaration
---
# Options Structure Reference
Options
=======
A set of options to be executed prior to moving a downloaded file from the temporary `URL` to the destination `URL`.
* `[createIntermediateDirectories](#/s:9Alamofire15DownloadRequestC7OptionsV29createIntermediateDirectoriesAEvpZ) `
Specifies that intermediate directories for the destination URL should be created.
#### Declaration
* `[removePreviousFile](#/s:9Alamofire15DownloadRequestC7OptionsV18removePreviousFileAEvpZ) `
Specifies that any previous file at the destination `URL` should be removed.
#### Declaration
* `[rawValue](#/s:SY8rawValue03RawB0Qzvp) `
#### Declaration
* `[init(rawValue:)](#/s:s9OptionSetP8rawValuex03RawD0Qz_tcfc) `
#### Declaration
---
# DownloadRequest Class Reference
DownloadRequest
===============
`[Request](../Classes/Request.html) ` subclass which downloads `Data` to a file on disk using `URLSessionDownloadTask`.
* `[Options](#/s:9Alamofire15DownloadRequestC7OptionsV) `
A set of options to be executed prior to moving a downloaded file from the temporary `URL` to the destination `URL`.
[See more](../Classes/DownloadRequest/Options.html)
#### Declaration
[](#/Destination)
### Destination
* `[Destination](#/s:9Alamofire15DownloadRequestC11Destinationa) `
A closure executed once a `DownloadRequest` has successfully completed in order to determine where to move the temporary file written to during the download process. The closure takes two arguments: the temporary file URL and the `HTTPURLResponse`, and returns two values: the file URL where the temporary file should be moved and the options defining how the file should be moved.
#### Declaration
* `[suggestedDownloadDestination(for:in:options:)](#/s:9Alamofire15DownloadRequestC09suggestedB11Destination3for2in7options10Foundation3URLV011destinationJ0_AC7OptionsVAGtAJ_So17NSHTTPURLResponseCtYbcSo21NSSearchPathDirectoryV_So0nO10DomainMaskVAMtFZ) `
Creates a download file destination closure which uses the default file manager to move the temporary file to a file URL in the first available directory with the specified search path directory and search path domain mask.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_directory_` | The search path directory. `.documentDirectory` by default. |
| `_domain_` | The search path domain mask. `.userDomainMask` by default. |
| `_options_` | `[DownloadRequest.Options](../Classes/DownloadRequest/Options.html) ` used when moving the downloaded file to its destination. None by default. |
#### Return Value
The `[Destination](../Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC11Destinationa) ` closure.
[](#/Downloadable)
### Downloadable
* `[Downloadable](#/s:9Alamofire15DownloadRequestC12DownloadableO) `
Type describing the source used to create the underlying `URLSessionDownloadTask`.
[See more](../Classes/DownloadRequest/Downloadable.html)
#### Declaration
[](#/Mutable%20State)
### Mutable State
* `[resumeData](#/s:9Alamofire15DownloadRequestC10resumeData10Foundation0E0VSgvp) `
If the download is resumable and is eventually cancelled or fails, this value may be used to resume the download using the `download(resumingWith data:)` API.
#### Declaration
* `[fileURL](#/s:9Alamofire15DownloadRequestC7fileURL10Foundation0E0VSgvp) `
If the download is successful, the `URL` where the file was downloaded.
#### Declaration
[](#/Initial%20State)
### Initial State
* `[downloadable](#/s:9Alamofire15DownloadRequestC12downloadableAC12DownloadableOvp) `
`[Downloadable](../Classes/DownloadRequest/Downloadable.html) ` value used for this instance.
#### Declaration
* `[task(forResumeData:using:)](#/s:9Alamofire15DownloadRequestC4task13forResumeData5usingSo16NSURLSessionTaskC10Foundation0G0V_So0I0CtF) `
Creates a `URLSessionTask` from the provided resume data.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_data_` | `Data` used to resume the download. |
| `_session_` | `URLSession` used to create the `URLSessionTask`. |
#### Return Value
The `URLSessionTask` created.
* `[cancel()](#/s:9Alamofire15DownloadRequestC6cancelACXDyF) `
Cancels the instance. Once cancelled, a `DownloadRequest` can no longer be resumed or suspended.
#### Declaration
#### Return Value
The instance.
* `[cancel(producingResumeData:)](#/s:9Alamofire15DownloadRequestC6cancel19producingResumeDataACXDSb_tF) `
Cancels the instance, optionally producing resume data. Once cancelled, a `DownloadRequest` can no longer be resumed or suspended.
#### Declaration
#### Return Value
The instance.
* `[cancel(byProducingResumeData:)](#/s:9Alamofire15DownloadRequestC6cancel21byProducingResumeDataACXDy10Foundation0H0VSgc_tF) `
Cancels the instance while producing resume data. Once cancelled, a `DownloadRequest` can no longer be resumed or suspended.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_completionHandler_` | The completion handler that is called when the download has been successfully cancelled. It is not guaranteed to be called on a particular queue, so you may want use an appropriate queue to perform your work. |
#### Return Value
The instance.
* `[validate(_:)](#/s:9Alamofire15DownloadRequestC8validateyACXDs6ResultOyyts5Error_pG10Foundation10URLRequestVSg_So17NSHTTPURLResponseCAI3URLVSgtYbcF) `
Validates the request, using the specified closure.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_validation_` | `[Validation](../Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC10Validationa) ` closure to validate the response. |
#### Return Value
The instance.
[](#/Response%20Serialization)
### Response Serialization
* `[response(queue:completionHandler:)](#/s:9Alamofire15DownloadRequestC8response5queue17completionHandlerACXDSo012OS_dispatch_E0C_yAA0B8ResponseVy10Foundation3URLVSgAA7AFErrorOGctF) `
Adds a handler to be called once the request has finished.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. |
| `_completionHandler_` | The code to be executed once the request has finished. |
#### Return Value
The request.
* `[response(queue:responseSerializer:completionHandler:)](#/s:9Alamofire15DownloadRequestC8response5queue0D10Serializer17completionHandlerACXDSo012OS_dispatch_E0C_xyAA0B8ResponseVy16SerializedObjectQzAA7AFErrorOGYbctAA0bkF8ProtocolRzlF) `
Adds a handler to be called once the request has finished.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. |
| `_responseSerializer_` | The response serializer responsible for serializing the request, response, and data contained in the destination `URL`. |
| `_completionHandler_` | The code to be executed once the request has finished. |
#### Return Value
The request.
* `[response(queue:responseSerializer:completionHandler:)](#/s:9Alamofire15DownloadRequestC8response5queue0D10Serializer17completionHandlerACXDSo012OS_dispatch_E0C_xyAA0B8ResponseVy16SerializedObjectQzAA7AFErrorOGYbctAA0kF0RzlF) `
Adds a handler to be called once the request has finished.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. |
| `_responseSerializer_` | The response serializer responsible for serializing the request, response, and data contained in the destination `URL`. |
| `_completionHandler_` | The code to be executed once the request has finished. |
#### Return Value
The request.
* `[responseURL(queue:completionHandler:)](#/s:9Alamofire15DownloadRequestC11responseURL5queue17completionHandlerACXDSo012OS_dispatch_F0C_yAA0B8ResponseVy10Foundation0E0VAA7AFErrorOGctF) `
Adds a handler using a `[URLResponseSerializer](../Structs/URLResponseSerializer.html) ` to be called once the request is finished.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | The queue on which the completion handler is called. `.main` by default. |
| `_completionHandler_` | A closure to be executed once the request has finished. |
#### Return Value
The request.
* `[responseData(queue:dataPreprocessor:emptyResponseCodes:emptyRequestMethods:completionHandler:)](#/s:9Alamofire15DownloadRequestC12responseData5queue16dataPreprocessor18emptyResponseCodes0iC7Methods17completionHandlerACXDSo012OS_dispatch_F0C_AA0eH0_pShySiGShyAA10HTTPMethodVGyAA0bJ0Vy10Foundation0E0VAA7AFErrorOGctF) `
Adds a handler using a `[DataResponseSerializer](../Classes/DataResponseSerializer.html) ` to be called once the request has finished.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | The queue on which the completion handler is called. `.main` by default. |
| `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the `completionHandler`. `PassthroughPreprocessor()` by default. |
| `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. |
| `_completionHandler_` | A closure to be executed once the request has finished. |
#### Return Value
The request.
* `[responseString(queue:dataPreprocessor:encoding:emptyResponseCodes:emptyRequestMethods:completionHandler:)](#/s:9Alamofire15DownloadRequestC14responseString5queue16dataPreprocessor8encoding18emptyResponseCodes0jC7Methods17completionHandlerACXDSo012OS_dispatch_F0C_AA04DataH0_pSS10FoundationE8EncodingVSgShySiGShyAA10HTTPMethodVGyAA0bK0VySSAA7AFErrorOGctF) `
Adds a handler using a `[StringResponseSerializer](../Classes/StringResponseSerializer.html) ` to be called once the request has finished.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. |
| `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the `completionHandler`. `PassthroughPreprocessor()` by default. |
| `_encoding_` | The string encoding. Defaults to `nil`, in which case the encoding will be determined from the server response, falling back to the default HTTP character set, `ISO-8859-1`. |
| `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. |
| `_completionHandler_` | A closure to be executed once the request has finished. |
#### Return Value
The request.
* `[responseJSON(queue:dataPreprocessor:emptyResponseCodes:emptyRequestMethods:options:completionHandler:)](#/s:9Alamofire15DownloadRequestC12responseJSON5queue16dataPreprocessor18emptyResponseCodes0iC7Methods7options17completionHandlerACXDSo012OS_dispatch_F0C_AA04DataH0_pShySiGShyAA10HTTPMethodVGSo20NSJSONReadingOptionsVyAA0bJ0VyypAA7AFErrorOGctF) `
Adds a handler using a `[JSONResponseSerializer](../Classes/JSONResponseSerializer.html) ` to be called once the request has finished.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. |
| `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the `completionHandler`. `PassthroughPreprocessor()` by default. |
| `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. |
| `_options_` | `JSONSerialization.ReadingOptions` used when parsing the response. `.allowFragments` by default. |
| `_completionHandler_` | A closure to be executed once the request has finished. |
#### Return Value
The request.
* `[responseDecodable(of:queue:dataPreprocessor:decoder:emptyResponseCodes:emptyRequestMethods:completionHandler:)](#/s:9Alamofire15DownloadRequestC17responseDecodable2of5queue16dataPreprocessor7decoder18emptyResponseCodes0kC7Methods17completionHandlerACXDxm_So012OS_dispatch_G0CAA04DataI0_pAA0S7Decoder_pShySiGShyAA10HTTPMethodVGyAA0bL0VyxAA7AFErrorOGctSeRzlF) `
Adds a handler using a `[DecodableResponseSerializer](../Classes/DecodableResponseSerializer.html) ` to be called once the request has finished.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_type_` | `Decodable` type to decode from response data. |
| `_queue_` | The queue on which the completion handler is dispatched. `.main` by default. |
| `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the `completionHandler`. `PassthroughPreprocessor()` by default. |
| `_decoder_` | `[DataDecoder](../Protocols/DataDecoder.html) ` to use to decode the response. `JSONDecoder()` by default. |
| `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. |
| `_completionHandler_` | A closure to be executed once the request has finished. |
#### Return Value
The request.
[](#/DataRequest%20%2F%20UploadRequest)
### DataRequest / UploadRequest
* `[publishResponse(using:on:)](#/s:9Alamofire15DownloadRequestC15publishResponse5using2onAA0bE9PublisherVyq_Gx_So17OS_dispatch_queueCtAA0E10SerializerRz16SerializedObjectQzRs_r0_lF) `
Creates a `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) ` for this instance using the given `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` and `DispatchQueue`.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_serializer_` | `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` used to serialize the response `Data` from disk. |
| `_queue_` | `DispatchQueue` on which the `[DownloadResponse](../Structs/DownloadResponse.html) ` will be published.`.main` by default. |
#### Return Value
The `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) `.
* `[publishResponse(using:on:)](#/s:9Alamofire15DownloadRequestC15publishResponse5using2onAA0bE9PublisherVyq_Gx_So17OS_dispatch_queueCtAA0bE18SerializerProtocolRz16SerializedObjectQzRs_r0_lF) `
Creates a `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) ` for this instance using the given `[DownloadResponseSerializerProtocol](../Protocols/DownloadResponseSerializerProtocol.html) ` and `DispatchQueue`.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_serializer_` | `DownloadResponseSerializer` used to serialize the response `Data` from disk. |
| `_queue_` | `DispatchQueue` on which the `[DownloadResponse](../Structs/DownloadResponse.html) ` will be published.`.main` by default. |
#### Return Value
The `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) `.
* `[publishURL(queue:)](#/s:9Alamofire15DownloadRequestC10publishURL5queueAA0B17ResponsePublisherVy10Foundation0E0VGSo012OS_dispatch_F0C_tF) `
Creates a `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) ` for this instance and uses a `[URLResponseSerializer](../Structs/URLResponseSerializer.html) ` to serialize the response.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | `DispatchQueue` on which the `[DownloadResponse](../Structs/DownloadResponse.html) ` will be published. `.main` by default. |
#### Return Value
The `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) `.
* `[publishData(queue:preprocessor:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire15DownloadRequestC11publishData5queue12preprocessor18emptyResponseCodes0hC7MethodsAA0bI9PublisherVy10Foundation0E0VGSo012OS_dispatch_F0C_AA0E12Preprocessor_pShySiGShyAA10HTTPMethodVGtF) `
Creates a `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) ` for this instance and uses a `[DataResponseSerializer](../Classes/DataResponseSerializer.html) ` to serialize the response.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | `DispatchQueue` on which the `[DownloadResponse](../Structs/DownloadResponse.html) ` will be published. `.main` by default. |
| `_preprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which filters the `Data` before serialization. `PassthroughPreprocessor()` by default. |
| `_emptyResponseCodes_` | `Set` of HTTP status codes for which empty responses are allowed. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `Set` of `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are allowed, regardless of status code. `[.head]` by default. |
#### Return Value
The `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) `.
* `[publishString(queue:preprocessor:encoding:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire15DownloadRequestC13publishString5queue12preprocessor8encoding18emptyResponseCodes0iC7MethodsAA0bJ9PublisherVySSGSo012OS_dispatch_F0C_AA16DataPreprocessor_pSS10FoundationE8EncodingVSgShySiGShyAA10HTTPMethodVGtF) `
Creates a `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) ` for this instance and uses a `[StringResponseSerializer](../Classes/StringResponseSerializer.html) ` to serialize the response.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | `DispatchQueue` on which the `[DataResponse](../Structs/DataResponse.html) ` will be published. `.main` by default. |
| `_preprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which filters the `Data` before serialization. `PassthroughPreprocessor()` by default. |
| `_encoding_` | `String.Encoding` to parse the response. `nil` by default, in which case the encoding will be determined by the server response, falling back to the default HTTP character set, `ISO-8859-1`. |
| `_emptyResponseCodes_` | `Set` of HTTP status codes for which empty responses are allowed. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `Set` of `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are allowed, regardless of status code. `[.head]` by default. |
#### Return Value
The `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) `.
* `[publishDecodable(type:queue:preprocessor:decoder:emptyResponseCodes:emptyResponseMethods:)](#/s:9Alamofire15DownloadRequestC16publishDecodable4type5queue12preprocessor7decoder18emptyResponseCodes0jK7MethodsAA0bK9PublisherVyxGxm_So012OS_dispatch_G0CAA16DataPreprocessor_pAA0Q7Decoder_pShySiGShyAA10HTTPMethodVGtSeRzs8SendableRzlF) `
Undocumented
#### Declaration
* `[publishDecodable(type:queue:preprocessor:decoder:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire15DownloadRequestC16publishDecodable4type5queue12preprocessor7decoder18emptyResponseCodes0jC7MethodsAA0bK9PublisherVyxGxm_So012OS_dispatch_G0CAA16DataPreprocessor_pAA0Q7Decoder_pShySiGShyAA10HTTPMethodVGtSeRzs8SendableRzlF) `
Creates a `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) ` for this instance and uses a `[DecodableResponseSerializer](../Classes/DecodableResponseSerializer.html) ` to serialize the response.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_type_` | `Decodable` type to which to decode response `Data`. Inferred from the context by default. |
| `_queue_` | `DispatchQueue` on which the `[DataResponse](../Structs/DataResponse.html) ` will be published. `.main` by default. |
| `_preprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which filters the `Data` before serialization. `PassthroughPreprocessor()` by default. |
| `_decoder_` | `[DataDecoder](../Protocols/DataDecoder.html) ` instance used to decode response `Data`. `JSONDecoder()` by default. |
| `_emptyResponseCodes_` | `Set` of HTTP status codes for which empty responses are allowed. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `Set` of `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are allowed, regardless of status code. `[.head]` by default. |
#### Return Value
The `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) `.
* `[publishUnserialized(on:)](#/s:9Alamofire15DownloadRequestC19publishUnserialized2onAA0B17ResponsePublisherVy10Foundation3URLVSgGSo17OS_dispatch_queueC_tF) `
Creates a `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) ` for this instance which does not serialize the response before publishing.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | `DispatchQueue` on which the `[DownloadResponse](../Structs/DownloadResponse.html) ` will be published. `.main` by default. |
#### Return Value
The `[DownloadResponsePublisher](../Structs/DownloadResponsePublisher.html) `.
[](#/DownloadTask)
### DownloadTask
* `[serializingData(automaticallyCancelling:dataPreprocessor:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire15DownloadRequestC15serializingData23automaticallyCancelling16dataPreprocessor18emptyResponseCodes0jC7MethodsAA0B4TaskVy10Foundation0E0VGSb_AA0eI0_pShySiGShyAA10HTTPMethodVGtF) `
Creates a `[DownloadTask](../Structs/DownloadTask.html) ` to `await` a `Data` value.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DownloadTask](../Structs/DownloadTask.html) `‘s async properties. `true` by default. |
| `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before completion. |
| `_emptyResponseCodes_` | HTTP response codes for which empty responses are allowed. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. |
#### Return Value
The `[DownloadTask](../Structs/DownloadTask.html) `.
* `[serializingDecodable(_:automaticallyCancelling:dataPreprocessor:decoder:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire15DownloadRequestC20serializingDecodable_23automaticallyCancelling16dataPreprocessor7decoder18emptyResponseCodes0kC7MethodsAA0B4TaskVyxGxm_SbAA04DataI0_pAA0P7Decoder_pShySiGShyAA10HTTPMethodVGtSeRzs8SendableRzlF) `
Creates a `[DownloadTask](../Structs/DownloadTask.html) ` to `await` serialization of a `Decodable` value.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_type_` | `Decodable` type to decode from response data. |
| `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DownloadTask](../Structs/DownloadTask.html) `‘s async properties. `true` by default. |
| `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the serializer. `PassthroughPreprocessor()` by default. |
| `_decoder_` | `[DataDecoder](../Protocols/DataDecoder.html) ` to use to decode the response. `JSONDecoder()` by default. |
| `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. |
#### Return Value
The `[DownloadTask](../Structs/DownloadTask.html) `.
* `[serializingDownloadedFileURL(automaticallyCancelling:)](#/s:9Alamofire15DownloadRequestC28serializingDownloadedFileURL23automaticallyCancellingAA0B4TaskVy10Foundation0G0VGSb_tF) `
Creates a `[DownloadTask](../Structs/DownloadTask.html) ` to `await` serialization of the downloaded file’s `URL` on disk.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DownloadTask](../Structs/DownloadTask.html) `‘s async properties. `true` by default. |
#### Return Value
The `[DownloadTask](../Structs/DownloadTask.html) `.
* `[serializingString(automaticallyCancelling:dataPreprocessor:encoding:emptyResponseCodes:emptyRequestMethods:)](#/s:9Alamofire15DownloadRequestC17serializingString23automaticallyCancelling16dataPreprocessor8encoding18emptyResponseCodes0kC7MethodsAA0B4TaskVySSGSb_AA04DataI0_pSS10FoundationE8EncodingVSgShySiGShyAA10HTTPMethodVGtF) `
Creates a `[DownloadTask](../Structs/DownloadTask.html) ` to `await` serialization of a `String` value.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DownloadTask](../Structs/DownloadTask.html) `‘s async properties. `true` by default. |
| `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` which processes the received `Data` before calling the serializer. `PassthroughPreprocessor()` by default. |
| `_encoding_` | `String.Encoding` to use during serialization. Defaults to `nil`, in which case the encoding will be determined from the server response, falling back to the default HTTP character set, `ISO-8859-1`. |
| `_emptyResponseCodes_` | HTTP status codes for which empty responses are always valid. `[204, 205]` by default. |
| `_emptyRequestMethods_` | `[HTTPMethod](../Structs/HTTPMethod.html) `s for which empty responses are always valid. `[.head]` by default. |
#### Return Value
The `[DownloadTask](../Structs/DownloadTask.html) `.
* `[serializingDownload(using:automaticallyCancelling:)](#/s:9Alamofire15DownloadRequestC011serializingB05using23automaticallyCancellingAA0B4TaskVy16SerializedObjectQzGx_SbtAA18ResponseSerializerRzlF) `
Creates a `[DownloadTask](../Structs/DownloadTask.html) ` to `await` serialization using the provided `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` instance.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_serializer_` | `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` responsible for serializing the request, response, and data. |
| `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DownloadTask](../Structs/DownloadTask.html) `‘s async properties. `true` by default. |
#### Return Value
The `[DownloadTask](../Structs/DownloadTask.html) `.
* `[serializingDownload(using:automaticallyCancelling:)](#/s:9Alamofire15DownloadRequestC011serializingB05using23automaticallyCancellingAA0B4TaskVy16SerializedObjectQzGx_SbtAA0B26ResponseSerializerProtocolRzlF) `
Creates a `[DownloadTask](../Structs/DownloadTask.html) ` to `await` serialization using the provided `[DownloadResponseSerializerProtocol](../Protocols/DownloadResponseSerializerProtocol.html) ` instance.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_serializer_` | `[DownloadResponseSerializerProtocol](../Protocols/DownloadResponseSerializerProtocol.html) ` responsible for serializing the request, response, and data. |
| `_shouldAutomaticallyCancel_` | `Bool` determining whether or not the request should be cancelled when the enclosing async context is cancelled. Only applies to `[DownloadTask](../Structs/DownloadTask.html) `‘s async properties. `true` by default. |
#### Return Value
The `[DownloadTask](../Structs/DownloadTask.html) `.
* `[Validation](#/s:9Alamofire15DownloadRequestC10Validationa) `
A closure used to validate a request that takes a URL request, a URL response, a temporary URL and a destination URL, and returns whether the request was valid.
#### Declaration
* `[validate(statusCode:)](#/s:9Alamofire15DownloadRequestC8validate10statusCodeACXDx_tSTRzSi7ElementRtzlF) `
Validates that the response has a status code in the specified sequence.
If validation fails, subsequent calls to response handlers will have an associated error.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_acceptableStatusCodes_` | `Sequence` of acceptable response status codes. |
#### Return Value
The instance.
* `[validate(contentType:)](#/s:9Alamofire15DownloadRequestC8validate11contentTypeACXDxyXA_tSTRzSS7ElementRtzlF) `
Validates that the response has a `Content-Type` in the specified sequence.
If validation fails, subsequent calls to response handlers will have an associated error.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_contentType_` | The acceptable content types, which may specify wildcard types and/or subtypes. |
#### Return Value
The request.
* `[validate()](#/s:9Alamofire15DownloadRequestC8validateACXDyF) `
Validates that the response has a status code in the default acceptable range of 200…299, and that the content type matches any specified in the Accept HTTP header field.
If validation fails, subsequent calls to response handlers will have an associated error.
#### Declaration
#### Return Value
The request.
---
# JSONParameterEncoder Class Reference
JSONParameterEncoder
====================
A `[ParameterEncoder](../Protocols/ParameterEncoder.html) ` that encodes types as JSON body data.
If no `Content-Type` header is already set on the provided `URLRequest`s, it’s set to `application/json`.
* `[default](#/s:9Alamofire20JSONParameterEncoderC7defaultACvpZ) `
Returns an encoder with default parameters.
#### Declaration
* `[prettyPrinted](#/s:9Alamofire20JSONParameterEncoderC13prettyPrintedACvpZ) `
Returns an encoder with `JSONEncoder.outputFormatting` set to `.prettyPrinted`.
#### Declaration
* `[sortedKeys](#/s:9Alamofire20JSONParameterEncoderC10sortedKeysACvpZ) `
Returns an encoder with `JSONEncoder.outputFormatting` set to `.sortedKeys`.
#### Declaration
* `[encoder](#/s:9Alamofire20JSONParameterEncoderC7encoder10Foundation11JSONEncoderCvp) `
`JSONEncoder` used to encode parameters.
#### Declaration
* `[init(encoder:)](#/s:9Alamofire20JSONParameterEncoderC7encoderAC10Foundation11JSONEncoderC_tcfc) `
Creates an instance with the provided `JSONEncoder`.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_encoder_` | The `JSONEncoder`. `JSONEncoder()` by default. |
* `[encode(_:into:)](#/s:9Alamofire16ParameterEncoderP6encode_4into10Foundation10URLRequestVqd__Sg_AHtKSERd__s8SendableRd__lF) `
#### Declaration
---
# Downloadable Enumeration Reference
Downloadable
============
Type describing the source used to create the underlying `URLSessionDownloadTask`.
* `[request(_:)](#/s:9Alamofire15DownloadRequestC12DownloadableO7requestyAeA21URLRequestConvertible_pcAEmF) `
Download should be started from the `URLRequest` produced by the associated `[URLRequestConvertible](../../Protocols/URLRequestConvertible.html) ` value.
#### Declaration
* `[resumeData(_:)](#/s:9Alamofire15DownloadRequestC12DownloadableO10resumeDatayAE10Foundation0F0VcAEmF) `
Download should be started from the associated resume `Data` value.
#### Declaration
---
# Interceptor Class Reference
Interceptor
===========
`[RequestInterceptor](../Protocols/RequestInterceptor.html) ` which can use multiple `[RequestAdapter](../Protocols/RequestAdapter.html) ` and `[RequestRetrier](../Protocols/RequestRetrier.html) ` values.
* `[adapters](#/s:9Alamofire11InterceptorC8adaptersSayAA14RequestAdapter_pGvp) `
All `[RequestAdapter](../Protocols/RequestAdapter.html) `s associated with the instance. These adapters will be run until one fails.
#### Declaration
* `[retriers](#/s:9Alamofire11InterceptorC8retriersSayAA14RequestRetrier_pGvp) `
All `[RequestRetrier](../Protocols/RequestRetrier.html) `s associated with the instance. These retriers will be run one at a time until one triggers retry.
#### Declaration
* `[init(adaptHandler:retryHandler:)](#/s:9Alamofire11InterceptorC12adaptHandler05retryD0ACy10Foundation10URLRequestV_AA7SessionCys6ResultOyAHs5Error_pGYbctYbc_yAA7RequestC_AJsAM_pyAA05RetryI0OYbctYbctcfc) `
Creates an instance from `[AdaptHandler](../Typealiases.html#/s:9Alamofire12AdaptHandlera) ` and `[RetryHandler](../Typealiases.html#/s:9Alamofire12RetryHandlera) ` closures.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_adaptHandler_` | `[AdaptHandler](../Typealiases.html#/s:9Alamofire12AdaptHandlera) ` closure to be used. |
| `_retryHandler_` | `[RetryHandler](../Typealiases.html#/s:9Alamofire12RetryHandlera) ` closure to be used. |
* `[init(adapter:retrier:)](#/s:9Alamofire11InterceptorC7adapter7retrierAcA14RequestAdapter_p_AA0E7Retrier_ptcfc) `
Creates an instance from `[RequestAdapter](../Protocols/RequestAdapter.html) ` and `[RequestRetrier](../Protocols/RequestRetrier.html) ` values.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_adapter_` | `[RequestAdapter](../Protocols/RequestAdapter.html) ` value to be used. |
| `_retrier_` | `[RequestRetrier](../Protocols/RequestRetrier.html) ` value to be used. |
* `[init(adapters:retriers:interceptors:)](#/s:9Alamofire11InterceptorC8adapters8retriers12interceptorsACSayAA14RequestAdapter_pG_SayAA0F7Retrier_pGSayAA0fB0_pGtcfc) `
Creates an instance from the arrays of `[RequestAdapter](../Protocols/RequestAdapter.html) ` and `[RequestRetrier](../Protocols/RequestRetrier.html) ` values.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_adapters_` | `[RequestAdapter](../Protocols/RequestAdapter.html) ` values to be used. |
| `_retriers_` | `[RequestRetrier](../Protocols/RequestRetrier.html) ` values to be used. |
| `_interceptors_` | `[RequestInterceptor](../Protocols/RequestInterceptor.html) `s to be used. |
* `[adapt(_:for:completion:)](#/s:9Alamofire14RequestAdapterP5adapt_3for10completiony10Foundation10URLRequestV_AA7SessionCys6ResultOyAIs5Error_pGYbctF) `
#### Declaration
* `[adapt(_:using:completion:)](#/s:9Alamofire14RequestAdapterP5adapt_5using10completiony10Foundation10URLRequestV_AA0bC5StateVys6ResultOyAIs5Error_pGYbctF) `
#### Declaration
* `[retry(_:for:dueTo:completion:)](#/s:9Alamofire14RequestRetrierP5retry_3for5dueTo10completionyAA0B0C_AA7SessionCs5Error_pyAA11RetryResultOYbctF) `
#### Declaration
---
# JSONResponseSerializer Class Reference
JSONResponseSerializer
======================
A `[ResponseSerializer](../Protocols/ResponseSerializer.html) ` that decodes the response data using `JSONSerialization`. By default, a request returning `nil` or no data is considered an error. However, if the request has an `[HTTPMethod](../Structs/HTTPMethod.html) ` or the response has an HTTP status code valid for empty responses, then an `NSNull` value is returned.
* `[dataPreprocessor](#/s:9Alamofire18ResponseSerializerP16dataPreprocessorAA04DataE0_pvp) `
#### Declaration
* `[emptyResponseCodes](#/s:9Alamofire18ResponseSerializerP05emptyB5CodesShySiGvp) `
#### Declaration
* `[emptyRequestMethods](#/s:9Alamofire18ResponseSerializerP19emptyRequestMethodsShyAA10HTTPMethodVGvp) `
#### Declaration
* `[options](#/s:9Alamofire22JSONResponseSerializerC7optionsSo20NSJSONReadingOptionsVvp) `
`JSONSerialization.ReadingOptions` used when serializing a response.
#### Declaration
* `[init(dataPreprocessor:emptyResponseCodes:emptyRequestMethods:options:)](#/s:9Alamofire22JSONResponseSerializerC16dataPreprocessor18emptyResponseCodes0F14RequestMethods7optionsAcA04DataE0_p_ShySiGShyAA10HTTPMethodVGSo20NSJSONReadingOptionsVtcfc) `
Creates an instance with the provided values.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_dataPreprocessor_` | `[DataPreprocessor](../Protocols/DataPreprocessor.html) ` used to prepare the received `Data` for serialization. |
| `_emptyResponseCodes_` | The HTTP response codes for which empty responses are allowed. `[204, 205]` by default. |
| `_emptyRequestMethods_` | The HTTP request methods for which empty responses are allowed. `[.head]` by default. |
| `_options_` | The options to use. `.allowFragments` by default. |
* `[serialize(request:response:data:error:)](#/s:9Alamofire30DataResponseSerializerProtocolP9serialize7request8response4data5error16SerializedObjectQz10Foundation10URLRequestVSg_So17NSHTTPURLResponseCSgAK0B0VSgs5Error_pSgtKF) `
#### Declaration
---
# MultipartFormData Class Reference
MultipartFormData
=================
Constructs `multipart/form-data` for uploads within an HTTP or HTTPS body. There are currently two ways to encode multipart form data. The first way is to encode the data directly in memory. This is very efficient, but can lead to memory issues if the dataset is too large. The second way is designed for larger datasets and will write all the data to a single file on disk with all the proper boundary segmentation. The second approach MUST be used for larger datasets such as video content, otherwise your app may run out of memory when trying to encode the dataset.
For more information on `multipart/form-data` in general, please refer to the RFC-2388 and RFC-2045 specs as well and the w3 form documentation.
* [https://www.ietf.org/rfc/rfc2388.txt](https://www.ietf.org/rfc/rfc2388.txt)
* [https://www.ietf.org/rfc/rfc2045.txt](https://www.ietf.org/rfc/rfc2045.txt)
* [https://www.w3.org/TR/html401/interact/forms.html#h-17.13](https://www.w3.org/TR/html401/interact/forms.html#h-17.13)
[](#/Properties)
### Properties
* `[encodingMemoryThreshold](#/s:9Alamofire17MultipartFormDataC23encodingMemoryThresholds6UInt64VvpZ) `
Default memory threshold used when encoding `MultipartFormData`, in bytes.
#### Declaration
* `[contentType](#/s:9Alamofire17MultipartFormDataC11contentTypeSSvp) `
The `Content-Type` header value containing the boundary used to generate the `multipart/form-data`.
#### Declaration
* `[contentLength](#/s:9Alamofire17MultipartFormDataC13contentLengths6UInt64Vvp) `
The content length of all body parts used to generate the `multipart/form-data` not including the boundaries.
#### Declaration
* `[boundary](#/s:9Alamofire17MultipartFormDataC8boundarySSvp) `
The boundary used to separate the body parts in the encoded form data.
#### Declaration
[](#/Lifecycle)
### Lifecycle
* `[init(fileManager:boundary:)](#/s:9Alamofire17MultipartFormDataC11fileManager8boundaryACSo06NSFileF0C_SSSgtcfc) `
Creates an instance.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_fileManager_` | `FileManager` to use for file operations, if needed. |
| `_boundary_` | Boundary `String` used to separate body parts. |
[](#/Body%20Parts)
### Body Parts
* `[append(_:withName:fileName:mimeType:)](#/s:9Alamofire17MultipartFormDataC6append_8withName04fileG08mimeTypey10Foundation0D0V_S2SSgAKtF) `
Creates a body part from the data and appends it to the instance.
The body part data will be encoded using the following format:
* `Content-Disposition: form-data; name=#{name}; filename=#{filename}` (HTTP Header)
* `Content-Type: #{mimeType}` (HTTP Header)
* Encoded file data
* Multipart form boundary
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_data_` | `Data` to encoding into the instance. |
| `_name_` | Name to associate with the `Data` in the `Content-Disposition` HTTP header. |
| `_fileName_` | Filename to associate with the `Data` in the `Content-Disposition` HTTP header. |
| `_mimeType_` | MIME type to associate with the data in the `Content-Type` HTTP header. |
* `[append(_:withName:)](#/s:9Alamofire17MultipartFormDataC6append_8withNamey10Foundation3URLV_SStF) `
Creates a body part from the file and appends it to the instance.
The body part data will be encoded using the following format:
* `Content-Disposition: form-data; name=#{name}; filename=#{generated filename}` (HTTP Header)
* `Content-Type: #{generated mimeType}` (HTTP Header)
* Encoded file data
* Multipart form boundary
The filename in the `Content-Disposition` HTTP header is generated from the last path component of the `fileURL`. The `Content-Type` HTTP header MIME type is generated by mapping the `fileURL` extension to the system associated MIME type.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_fileURL_` | `URL` of the file whose content will be encoded into the instance. |
| `_name_` | Name to associate with the file content in the `Content-Disposition` HTTP header. |
* `[append(_:withName:fileName:mimeType:)](#/s:9Alamofire17MultipartFormDataC6append_8withName04fileG08mimeTypey10Foundation3URLV_S3StF) `
Creates a body part from the file and appends it to the instance.
The body part data will be encoded using the following format:
* Content-Disposition: form-data; name=#{name}; filename=#{filename} (HTTP Header)
* Content-Type: #{mimeType} (HTTP Header)
* Encoded file data
* Multipart form boundary
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_fileURL_` | `URL` of the file whose content will be encoded into the instance. |
| `_name_` | Name to associate with the file content in the `Content-Disposition` HTTP header. |
| `_fileName_` | Filename to associate with the file content in the `Content-Disposition` HTTP header. |
| `_mimeType_` | MIME type to associate with the file content in the `Content-Type` HTTP header. |
* `[append(_:withLength:name:fileName:mimeType:)](#/s:9Alamofire17MultipartFormDataC6append_10withLength4name8fileName8mimeTypeySo13NSInputStreamC_s6UInt64VS3StF) `
Creates a body part from the stream and appends it to the instance.
The body part data will be encoded using the following format:
* `Content-Disposition: form-data; name=#{name}; filename=#{filename}` (HTTP Header)
* `Content-Type: #{mimeType}` (HTTP Header)
* Encoded stream data
* Multipart form boundary
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_stream_` | `InputStream` to encode into the instance. |
| `_length_` | Length, in bytes, of the stream. |
| `_name_` | Name to associate with the stream content in the `Content-Disposition` HTTP header. |
| `_fileName_` | Filename to associate with the stream content in the `Content-Disposition` HTTP header. |
| `_mimeType_` | MIME type to associate with the stream content in the `Content-Type` HTTP header. |
* `[append(_:withLength:headers:)](#/s:9Alamofire17MultipartFormDataC6append_10withLength7headersySo13NSInputStreamC_s6UInt64VAA11HTTPHeadersVtF) `
Creates a body part with the stream, length, and headers and appends it to the instance.
The body part data will be encoded using the following format:
* HTTP headers
* Encoded stream data
* Multipart form boundary
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_stream_` | `InputStream` to encode into the instance. |
| `_length_` | Length, in bytes, of the stream. |
| `_headers_` | `[HTTPHeaders](../Structs/HTTPHeaders.html) ` for the body part. |
[](#/Data%20Encoding)
### Data Encoding
* `[encode()](#/s:9Alamofire17MultipartFormDataC6encode10Foundation0D0VyKF) `
Encodes all appended body parts into a single `Data` value.
#### Declaration
#### Return Value
The encoded `Data`, if encoding is successful.
* `[writeEncodedData(to:)](#/s:9Alamofire17MultipartFormDataC012writeEncodedD02toy10Foundation3URLV_tKF) `
Writes all appended body parts to the given file `URL`.
This process is facilitated by reading and writing with input and output streams, respectively. Thus, this approach is very memory efficient and should be used for large body part data.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_fileURL_` | File `URL` to which to write the form data. |
---
# PinnedCertificatesTrustEvaluator Class Reference
PinnedCertificatesTrustEvaluator
================================
Uses the pinned certificates to validate the server trust. The server trust is considered valid if one of the pinned certificates match one of the server certificates. By validating both the certificate chain and host, certificate pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks. Applications are encouraged to always validate the host and require a valid certificate chain in production environments.
* `[init(certificates:acceptSelfSignedCertificates:performDefaultValidation:validateHost:)](#/s:9Alamofire32PinnedCertificatesTrustEvaluatorC12certificates016acceptSelfSignedC024performDefaultValidation12validateHostACSaySo17SecCertificateRefaG_S3btcfc) `
Creates a `PinnedCertificatesTrustEvaluator` from the provided parameters.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_certificates_` | The certificates to use to evaluate the trust. All `cer`, `crt`, and `der` certificates in `Bundle.main` by default. |
| `_acceptSelfSignedCertificates_` | Adds the provided certificates as anchors for the trust evaluation, allowing self-signed certificates to pass. `false` by default. THIS SETTING SHOULD BE FALSE IN PRODUCTION! |
| `_performDefaultValidation_` | Determines whether default validation should be performed in addition to evaluating the pinned certificates. `true` by default. |
| `_validateHost_` | Determines whether or not the evaluator should validate the host, in addition to performing the default evaluation, even if `performDefaultValidation` is `false`. `true` by default. |
* `[evaluate(_:forHost:)](#/s:9Alamofire21ServerTrustEvaluatingP8evaluate_7forHostySo03SecC3Refa_SStKF) `
#### Declaration
---
# NetworkReachabilityManager Class Reference
NetworkReachabilityManager
==========================
The `NetworkReachabilityManager` class listens for reachability changes of hosts and addresses for both cellular and WiFi network interfaces.
Reachability can be used to determine background information about why a network operation failed, or to retry network requests when a connection is established. It should not be used to prevent a user from initiating a network request, as it’s possible that an initial request may be required to establish reachability.
* `[NetworkReachabilityStatus](#/s:9Alamofire26NetworkReachabilityManagerC0bC6StatusO) `
Defines the various states of network reachability.
[See more](../Classes/NetworkReachabilityManager/NetworkReachabilityStatus.html)
#### Declaration
* `[Listener](#/s:9Alamofire26NetworkReachabilityManagerC8Listenera) `
A closure executed when the network reachability status changes. The closure takes a single argument: the network reachability status.
#### Declaration
* `[default](#/s:9Alamofire26NetworkReachabilityManagerC7defaultACSgvpZ) `
Default `NetworkReachabilityManager` for the zero address and a `listenerQueue` of `.main`.
#### Declaration
[](#/Properties)
### Properties
* `[isReachable](#/s:9Alamofire26NetworkReachabilityManagerC11isReachableSbvp) `
Whether the network is currently reachable.
#### Declaration
* `[isReachableOnCellular](#/s:9Alamofire26NetworkReachabilityManagerC21isReachableOnCellularSbvp) `
Whether the network is currently reachable over the cellular interface.
#### Declaration
* `[isReachableOnEthernetOrWiFi](#/s:9Alamofire26NetworkReachabilityManagerC27isReachableOnEthernetOrWiFiSbvp) `
Whether the network is currently reachable over Ethernet or WiFi interface.
#### Declaration
* `[reachabilityQueue](#/s:9Alamofire26NetworkReachabilityManagerC17reachabilityQueueSo17OS_dispatch_queueCvp) `
`DispatchQueue` on which reachability will update.
#### Declaration
* `[flags](#/s:9Alamofire26NetworkReachabilityManagerC5flagsSo09SCNetworkC5FlagsVSgvp) `
Flags of the current reachability type, if any.
#### Declaration
* `[status](#/s:9Alamofire26NetworkReachabilityManagerC6statusAC0bC6StatusOvp) `
The current network reachability status.
#### Declaration
[](#/Initialization)
### Initialization
* `[init(host:)](#/s:9Alamofire26NetworkReachabilityManagerC4hostACSgSS_tcfc) `
Creates an instance with the specified host.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_host_` | Host used to evaluate network reachability. Must _not_ include the scheme (e.g. `https`). |
* `[init()](#/s:9Alamofire26NetworkReachabilityManagerCACSgycfc) `
Creates an instance that monitors the address 0.0.0.0.
Reachability treats the 0.0.0.0 address as a special token that causes it to monitor the general routing status of the device, both IPv4 and IPv6.
#### Declaration
[](#/Listening)
### Listening
* `[startListening(onQueue:onUpdatePerforming:)](#/s:9Alamofire26NetworkReachabilityManagerC14startListening7onQueue0G16UpdatePerformingSbSo17OS_dispatch_queueC_yAC0bC6StatusOctF) `
Starts listening for changes in network reachability status.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | `DispatchQueue` on which to call the `listener` closure. `.main` by default. |
| `_listener_` | `[Listener](../Classes/NetworkReachabilityManager.html#/s:9Alamofire26NetworkReachabilityManagerC8Listenera) ` closure called when reachability changes. |
#### Return Value
`true` if listening was started successfully, `false` otherwise.
* `[stopListening()](#/s:9Alamofire26NetworkReachabilityManagerC13stopListeningyyF) `
Stops listening for changes in network reachability status.
#### Declaration
---
# NetworkReachabilityStatus Enumeration Reference
NetworkReachabilityStatus
=========================
Defines the various states of network reachability.
* `[unknown](#/s:9Alamofire26NetworkReachabilityManagerC0bC6StatusO7unknownyA2EmF) `
It is unknown whether the network is reachable.
#### Declaration
* `[notReachable](#/s:9Alamofire26NetworkReachabilityManagerC0bC6StatusO12notReachableyA2EmF) `
The network is not reachable.
#### Declaration
* `[reachable(_:)](#/s:9Alamofire26NetworkReachabilityManagerC0bC6StatusO9reachableyA2E14ConnectionTypeOcAEmF) `
The network is reachable on the associated `[ConnectionType](../../Classes/NetworkReachabilityManager/NetworkReachabilityStatus/ConnectionType.html) `.
#### Declaration
* `[ConnectionType](#/s:9Alamofire26NetworkReachabilityManagerC0bC6StatusO14ConnectionTypeO) `
Defines the various connection types detected by reachability flags.
[See more](../../Classes/NetworkReachabilityManager/NetworkReachabilityStatus/ConnectionType.html)
#### Declaration
---
# PublicKeysTrustEvaluator Class Reference
PublicKeysTrustEvaluator
========================
Uses the pinned public keys to validate the server trust. The server trust is considered valid if one of the pinned public keys match one of the server certificate public keys. By validating both the certificate chain and host, public key pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks. Applications are encouraged to always validate the host and require a valid certificate chain in production environments.
* `[init(keys:performDefaultValidation:validateHost:)](#/s:9Alamofire24PublicKeysTrustEvaluatorC4keys24performDefaultValidation12validateHostACSaySo9SecKeyRefaG_S2btcfc) `
Creates a `PublicKeysTrustEvaluator` from the provided parameters.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_keys_` | The `SecKey`s to use to validate public keys. Defaults to the public keys of all certificates included in the main bundle. |
| `_performDefaultValidation_` | Determines whether default validation should be performed in addition to evaluating the pinned certificates. `true` by default. |
| `_validateHost_` | Determines whether or not the evaluator should validate the host, in addition to performing the default evaluation, even if `performDefaultValidation` is `false`. `true` by default. |
* `[evaluate(_:forHost:)](#/s:9Alamofire21ServerTrustEvaluatingP8evaluate_7forHostySo03SecC3Refa_SStKF) `
#### Declaration
---
# Retrier Class Reference
Retrier
=======
Closure-based `[RequestRetrier](../Protocols/RequestRetrier.html) `.
* `[init(_:)](#/s:9Alamofire7RetrierCyACyAA7RequestC_AA7SessionCs5Error_pyAA11RetryResultOctccfc) `
Creates an instance using the provided closure.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_retryHandler_` | `[RetryHandler](../Typealiases.html#/s:9Alamofire12RetryHandlera) ` closure to be executed when handling request retry. |
* `[retry(_:for:dueTo:completion:)](#/s:9Alamofire14RequestRetrierP5retry_3for5dueTo10completionyAA0B0C_AA7SessionCs5Error_pyAA11RetryResultOYbctF) `
#### Declaration
---
# RetryPolicy Class Reference
RetryPolicy
===========
A retry policy that retries requests using an exponential backoff for allowed HTTP methods and HTTP status codes as well as certain types of networking errors.
* `[defaultRetryLimit](#/s:9Alamofire11RetryPolicyC07defaultB5LimitSuvpZ) `
The default retry limit for retry policies.
#### Declaration
* `[defaultExponentialBackoffBase](#/s:9Alamofire11RetryPolicyC29defaultExponentialBackoffBaseSuvpZ) `
The default exponential backoff base for retry policies (must be a minimum of 2).
#### Declaration
* `[defaultExponentialBackoffScale](#/s:9Alamofire11RetryPolicyC30defaultExponentialBackoffScaleSdvpZ) `
The default exponential backoff scale for retry policies.
#### Declaration
* `[defaultRetryableHTTPMethods](#/s:9Alamofire11RetryPolicyC27defaultRetryableHTTPMethodsShyAA10HTTPMethodVGvpZ) `
The default HTTP methods to retry. See [RFC 2616 - Section 9.1.2](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html)
for more information.
#### Declaration
* `[defaultRetryableHTTPStatusCodes](#/s:9Alamofire11RetryPolicyC31defaultRetryableHTTPStatusCodesShySiGvpZ) `
The default HTTP status codes to retry. See [RFC 2616 - Section 10](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10)
for more information.
#### Declaration
* `[defaultRetryableURLErrorCodes](#/s:9Alamofire11RetryPolicyC29defaultRetryableURLErrorCodesShy10Foundation0F0V4CodeVGvpZ) `
The default URL error codes to retry.
#### Declaration
* `[retryLimit](#/s:9Alamofire11RetryPolicyC10retryLimitSuvp) `
The total number of times the request is allowed to be retried.
#### Declaration
* `[exponentialBackoffBase](#/s:9Alamofire11RetryPolicyC22exponentialBackoffBaseSuvp) `
The base of the exponential backoff policy (should always be greater than or equal to 2).
#### Declaration
* `[exponentialBackoffScale](#/s:9Alamofire11RetryPolicyC23exponentialBackoffScaleSdvp) `
The scale of the exponential backoff.
#### Declaration
* `[retryableHTTPMethods](#/s:9Alamofire11RetryPolicyC20retryableHTTPMethodsShyAA10HTTPMethodVGvp) `
The HTTP methods that are allowed to be retried.
#### Declaration
* `[retryableHTTPStatusCodes](#/s:9Alamofire11RetryPolicyC24retryableHTTPStatusCodesShySiGvp) `
The HTTP status codes that are automatically retried by the policy.
#### Declaration
* `[retryableURLErrorCodes](#/s:9Alamofire11RetryPolicyC22retryableURLErrorCodesShy10Foundation0E0V4CodeVGvp) `
The URL error codes that are automatically retried by the policy.
#### Declaration
* `[init(retryLimit:exponentialBackoffBase:exponentialBackoffScale:retryableHTTPMethods:retryableHTTPStatusCodes:retryableURLErrorCodes:)](#/s:9Alamofire11RetryPolicyC10retryLimit22exponentialBackoffBase0fG5Scale20retryableHTTPMethods0J15HTTPStatusCodes0j8URLErrorM0ACSu_SuSdShyAA10HTTPMethodVGShySiGShy10Foundation0N0V4CodeVGtcfc) `
Creates a `RetryPolicy` from the specified parameters.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_retryLimit_` | The total number of times the request is allowed to be retried. `2` by default. |
| `_exponentialBackoffBase_` | The base of the exponential backoff policy. `2` by default. |
| `_exponentialBackoffScale_` | The scale of the exponential backoff. `0.5` by default. |
| `_retryableHTTPMethods_` | The HTTP methods that are allowed to be retried. `[RetryPolicy.defaultRetryableHTTPMethods](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC27defaultRetryableHTTPMethodsShyAA10HTTPMethodVGvpZ) ` by default. |
| `_retryableHTTPStatusCodes_` | The HTTP status codes that are automatically retried by the policy. `[RetryPolicy.defaultRetryableHTTPStatusCodes](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC31defaultRetryableHTTPStatusCodesShySiGvpZ) ` by default. |
| `_retryableURLErrorCodes_` | The URL error codes that are automatically retried by the policy. `[RetryPolicy.defaultRetryableURLErrorCodes](../Classes/RetryPolicy.html#/s:9Alamofire11RetryPolicyC29defaultRetryableURLErrorCodesShy10Foundation0F0V4CodeVGvpZ) ` by default. |
* `[retry(_:for:dueTo:completion:)](#/s:9Alamofire14RequestRetrierP5retry_3for5dueTo10completionyAA0B0C_AA7SessionCs5Error_pyAA11RetryResultOYbctF) `
#### Declaration
* `[shouldRetry(request:dueTo:)](#/s:9Alamofire11RetryPolicyC06shouldB07request5dueToSbAA7RequestC_s5Error_ptF) `
Determines whether or not to retry the provided `[Request](../Classes/Request.html) `.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_request_` | `[Request](../Classes/Request.html) ` that failed due to the provided `Error`. |
| `_error_` | `Error` encountered while executing the `[Request](../Classes/Request.html) `. |
#### Return Value
`Bool` determining whether or not to retry the `[Request](../Classes/Request.html) `.
---
# RevocationTrustEvaluator Class Reference
RevocationTrustEvaluator
========================
An evaluator which Uses the default and revoked server trust evaluations allowing you to control whether to validate the host provided by the challenge as well as specify the revocation flags for testing for revoked certificates. Apple platforms did not start testing for revoked certificates automatically until iOS 10.1, macOS 10.12 and tvOS 10.1 which is demonstrated in our TLS tests. Applications are encouraged to always validate the host in production environments to guarantee the validity of the server’s certificate chain.
* `[Options](#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV) `
Represents the options to be use when evaluating the status of a certificate. Only Revocation Policy Constants are valid, and can be found in [Apple’s documentation](https://developer.apple.com/documentation/security/certificate_key_and_trust_services/policies/1563600-revocation_policy_constants)
.
[See more](../Classes/RevocationTrustEvaluator/Options.html)
#### Declaration
* `[init(performDefaultValidation:validateHost:options:)](#/s:9Alamofire24RevocationTrustEvaluatorC24performDefaultValidation12validateHost7optionsACSb_SbAC7OptionsVtcfc) `
Creates a `RevocationTrustEvaluator` using the provided parameters.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_performDefaultValidation_` | Determines whether default validation should be performed in addition to evaluating the pinned certificates. `true` by default. |
| `_validateHost_` | Determines whether or not the evaluator should validate the host, in addition to performing the default evaluation, even if `performDefaultValidation` is `false`. `true` by default. |
| `_options_` | The `[Options](../Classes/RevocationTrustEvaluator/Options.html) ` to use to check the revocation status of the certificate. `.any` by default. |
* `[evaluate(_:forHost:)](#/s:9Alamofire21ServerTrustEvaluatingP8evaluate_7forHostySo03SecC3Refa_SStKF) `
#### Declaration
---
# Options Structure Reference
Options
=======
Represents the options to be use when evaluating the status of a certificate. Only Revocation Policy Constants are valid, and can be found in [Apple’s documentation](https://developer.apple.com/documentation/security/certificate_key_and_trust_services/policies/1563600-revocation_policy_constants)
.
* `[crl](#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV3crlAEvpZ) `
Perform revocation checking using the CRL (Certification Revocation List) method.
#### Declaration
* `[networkAccessDisabled](#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV21networkAccessDisabledAEvpZ) `
Consult only locally cached replies; do not use network access.
#### Declaration
* `[ocsp](#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV4ocspAEvpZ) `
Perform revocation checking using OCSP (Online Certificate Status Protocol).
#### Declaration
* `[preferCRL](#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV9preferCRLAEvpZ) `
Prefer CRL revocation checking over OCSP; by default, OCSP is preferred.
#### Declaration
* `[requirePositiveResponse](#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV23requirePositiveResponseAEvpZ) `
Require a positive response to pass the policy. If the flag is not set, revocation checking is done on a “best attempt” basis, where failure to reach the server is not considered fatal.
#### Declaration
* `[any](#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV3anyAEvpZ) `
Perform either OCSP or CRL checking. The checking is performed according to the method(s) specified in the certificate and the value of `[preferCRL](../../Classes/RevocationTrustEvaluator/Options.html#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV9preferCRLAEvpZ) `.
#### Declaration
* `[rawValue](#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV8rawValueSuvp) `
The raw value of the option.
#### Declaration
* `[init(rawValue:)](#/s:9Alamofire24RevocationTrustEvaluatorC7OptionsV8rawValueAESu_tcfc) `
Creates an `Options` value with the given `CFOptionFlags`.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_rawValue_` | The `CFOptionFlags` value to initialize with. |
---
# ServerTrustManager Class Reference
ServerTrustManager
==================
Responsible for managing the mapping of `[ServerTrustEvaluating](../Protocols/ServerTrustEvaluating.html) ` values to given hosts.
* `[allHostsMustBeEvaluated](#/s:9Alamofire18ServerTrustManagerC23allHostsMustBeEvaluatedSbvp) `
Determines whether all hosts for this `ServerTrustManager` must be evaluated. `true` by default.
#### Declaration
* `[evaluators](#/s:9Alamofire18ServerTrustManagerC10evaluatorsSDySSAA0bC10Evaluating_pGvp) `
The dictionary of policies mapped to a particular host.
#### Declaration
* `[init(allHostsMustBeEvaluated:evaluators:)](#/s:9Alamofire18ServerTrustManagerC23allHostsMustBeEvaluated10evaluatorsACSb_SDySSAA0bC10Evaluating_pGtcfc) `
Initializes the `ServerTrustManager` instance with the given evaluators.
Since different servers and web services can have different leaf certificates, intermediate and even root certificates, it is important to have the flexibility to specify evaluation policies on a per host basis. This allows for scenarios such as using default evaluation for host1, certificate pinning for host2, public key pinning for host3 and disabling evaluation for host4.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_allHostsMustBeEvaluated_` | The value determining whether all hosts for this instance must be evaluated. `true` by default. |
| `_evaluators_` | A dictionary of evaluators mapped to hosts. |
* `[serverTrustEvaluator(forHost:)](#/s:9Alamofire18ServerTrustManagerC06serverC9Evaluator7forHostAA0bC10Evaluating_pSgSS_tKF) `
Returns the `[ServerTrustEvaluating](../Protocols/ServerTrustEvaluating.html) ` value for the given host, if one is set.
By default, this method will return the policy that perfectly matches the given host. Subclasses could override this method and implement more complex mapping implementations such as wildcards.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_host_` | The host to use when searching for a matching policy. |
#### Return Value
The `[ServerTrustEvaluating](../Protocols/ServerTrustEvaluating.html) ` value for the given host if found, `nil` otherwise.
---
# SessionDelegate Class Reference
SessionDelegate
===============
Class which implements the various `URLSessionDelegate` methods to connect various Alamofire features.
* `[init(fileManager:)](#/s:9Alamofire15SessionDelegateC11fileManagerACSo06NSFileE0C_tcfc) `
Creates an instance from the given `FileManager`.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_fileManager_` | `FileManager` to use for underlying file management, such as moving downloaded files. `.default` by default. |
[](#/URLSessionDelegate)
### URLSessionDelegate
* `[urlSession(_:didBecomeInvalidWithError:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:didBecomeInvalidWithError:) `
Undocumented
#### Declaration
[](#/URLSessionTaskDelegate)
### URLSessionTaskDelegate
* `[urlSession(_:task:didReceive:completionHandler:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:task:didReceiveChallenge:completionHandler:) `
Undocumented
#### Declaration
* `[urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:) `
Undocumented
#### Declaration
* `[urlSession(_:task:needNewBodyStream:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:task:needNewBodyStream:) `
Undocumented
#### Declaration
* `[urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:) `
Undocumented
#### Declaration
* `[urlSession(_:task:didFinishCollecting:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:task:didFinishCollectingMetrics:) `
Undocumented
#### Declaration
* `[urlSession(_:task:didCompleteWithError:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:task:didCompleteWithError:) `
Undocumented
#### Declaration
* `[urlSession(_:taskIsWaitingForConnectivity:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:taskIsWaitingForConnectivity:) `
Undocumented
#### Declaration
[](#/URLSessionDataDelegate)
### URLSessionDataDelegate
* `[urlSession(_:dataTask:didReceive:completionHandler:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:dataTask:didReceiveResponse:completionHandler:) `
Undocumented
#### Declaration
* `[urlSession(_:dataTask:didReceive:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:dataTask:didReceiveData:) `
Undocumented
#### Declaration
* `[urlSession(_:dataTask:willCacheResponse:completionHandler:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:dataTask:willCacheResponse:completionHandler:) `
Undocumented
#### Declaration
[](#/URLSessionWebSocketDelegate)
### URLSessionWebSocketDelegate
* `[urlSession(_:webSocketTask:didOpenWithProtocol:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:webSocketTask:didOpenWithProtocol:) `
Undocumented
#### Declaration
* `[urlSession(_:webSocketTask:didCloseWith:reason:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:webSocketTask:didCloseWithCode:reason:) `
Undocumented
#### Declaration
[](#/URLSessionDownloadDelegate)
### URLSessionDownloadDelegate
* `[urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:) `
Undocumented
#### Declaration
* `[urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:) `
Undocumented
#### Declaration
* `[urlSession(_:downloadTask:didFinishDownloadingTo:)](#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:downloadTask:didFinishDownloadingToURL:) `
Undocumented
#### Declaration
---
# Request Class Reference
Request
=======
`Request` is the common superclass of all Alamofire request types and provides common state, delegate, and callback handling.
* `[State](#/s:9Alamofire7RequestC5StateO) `
State of the `[Request](../Classes/Request.html) `, with managed transitions between states set when calling `[resume()](../Classes/Request.html#/s:9Alamofire7RequestC6resumeACXDyF) `, `[suspend()](../Classes/Request.html#/s:9Alamofire7RequestC7suspendACXDyF) `, or `[cancel()](../Classes/Request.html#/s:9Alamofire7RequestC6cancelACXDyF) ` on the `[Request](../Classes/Request.html) `.
[See more](../Classes/Request/State.html)
#### Declaration
[](#/Initial%20State)
### Initial State
* `[id](#/s:9Alamofire7RequestC2id10Foundation4UUIDVvp) `
`UUID` providing a unique identifier for the `Request`, used in the `Hashable` and `Equatable` conformances.
#### Declaration
* `[underlyingQueue](#/s:9Alamofire7RequestC15underlyingQueueSo17OS_dispatch_queueCvp) `
The serial queue for all internal async actions.
#### Declaration
* `[serializationQueue](#/s:9Alamofire7RequestC18serializationQueueSo17OS_dispatch_queueCvp) `
The queue used for all serialization actions. By default it’s a serial queue that targets `[underlyingQueue](../Classes/Request.html#/s:9Alamofire7RequestC15underlyingQueueSo17OS_dispatch_queueCvp) `.
#### Declaration
* `[eventMonitor](#/s:9Alamofire7RequestC12eventMonitorAA05EventD0_pSgvp) `
`[EventMonitor](../Protocols/EventMonitor.html) ` used for event callbacks.
#### Declaration
* `[interceptor](#/s:9Alamofire7RequestC11interceptorAA0B11Interceptor_pSgvp) `
The `Request`‘s interceptor.
#### Declaration
* `[delegate](#/s:9Alamofire7RequestC8delegateAA0B8Delegate_pSgvp) `
The `Request`‘s delegate.
#### Declaration
[](#/Mutable%20State)
### Mutable State
* `[state](#/s:9Alamofire7RequestC5stateAC5StateOvp) `
`[State](../Classes/Request/State.html) ` of the `Request`.
#### Declaration
* `[isInitialized](#/s:9Alamofire7RequestC13isInitializedSbvp) `
Returns whether `[state](../Classes/Request.html#/s:9Alamofire7RequestC5stateAC5StateOvp) ` is `.initialized`.
#### Declaration
* `[isResumed](#/s:9Alamofire7RequestC9isResumedSbvp) `
Returns whether `[state](../Classes/Request.html#/s:9Alamofire7RequestC5stateAC5StateOvp) ` is `.resumed`.
#### Declaration
* `[isSuspended](#/s:9Alamofire7RequestC11isSuspendedSbvp) `
Returns whether `[state](../Classes/Request.html#/s:9Alamofire7RequestC5stateAC5StateOvp) ` is `.suspended`.
#### Declaration
* `[isCancelled](#/s:9Alamofire7RequestC11isCancelledSbvp) `
Returns whether `[state](../Classes/Request.html#/s:9Alamofire7RequestC5stateAC5StateOvp) ` is `.cancelled`.
#### Declaration
* `[isFinished](#/s:9Alamofire7RequestC10isFinishedSbvp) `
Returns whether `[state](../Classes/Request.html#/s:9Alamofire7RequestC5stateAC5StateOvp) ` is `.finished`.
#### Declaration
[](#/Progress)
### Progress
* `[ProgressHandler](#/s:9Alamofire7RequestC15ProgressHandlera) `
Closure type executed when monitoring the upload or download progress of a request.
#### Declaration
* `[uploadProgress](#/s:9Alamofire7RequestC14uploadProgressSo10NSProgressCvp) `
`Progress` of the upload of the body of the executed `URLRequest`. Reset to `0` if the `Request` is retried.
#### Declaration
* `[downloadProgress](#/s:9Alamofire7RequestC16downloadProgressSo10NSProgressCvp) `
`Progress` of the download of any response data. Reset to `0` if the `Request` is retried.
#### Declaration
* `[uploadProgressHandler](#/s:9Alamofire7RequestC21uploadProgressHandlerySo10NSProgressCYbc7handler_So17OS_dispatch_queueC0J0tSgvp) `
`[ProgressHandler](../Classes/Request.html#/s:9Alamofire7RequestC15ProgressHandlera) ` called when `[uploadProgress](../Classes/Request.html#/s:9Alamofire7RequestC14uploadProgressSo10NSProgressCvp) ` is updated, on the provided `DispatchQueue`.
#### Declaration
* `[downloadProgressHandler](#/s:9Alamofire7RequestC23downloadProgressHandlerySo10NSProgressCYbc7handler_So17OS_dispatch_queueC0J0tSgvp) `
`[ProgressHandler](../Classes/Request.html#/s:9Alamofire7RequestC15ProgressHandlera) ` called when `[downloadProgress](../Classes/Request.html#/s:9Alamofire7RequestC16downloadProgressSo10NSProgressCvp) ` is updated, on the provided `DispatchQueue`.
#### Declaration
[](#/Redirect%20Handling)
### Redirect Handling
* `[redirectHandler](#/s:9Alamofire7RequestC15redirectHandlerAA08RedirectD0_pSgvp) `
`[RedirectHandler](../Protocols/RedirectHandler.html) ` set on the instance.
#### Declaration
[](#/Cached%20Response%20Handling)
### Cached Response Handling
* `[cachedResponseHandler](#/s:9Alamofire7RequestC21cachedResponseHandlerAA06CacheddE0_pSgvp) `
`[CachedResponseHandler](../Protocols/CachedResponseHandler.html) ` set on the instance.
#### Declaration
[](#/URLCredential)
### URLCredential
* `[credential](#/s:9Alamofire7RequestC10credentialSo15NSURLCredentialCSgvp) `
`URLCredential` used for authentication challenges. Created by calling one of the `authenticate` methods.
#### Declaration
[](#/URLRequests)
### URLRequests
* `[requests](#/s:9Alamofire7RequestC8requestsSay10Foundation10URLRequestVGvp) `
All `URLRequest`s created on behalf of the `Request`, including original and adapted requests.
#### Declaration
* `[firstRequest](#/s:9Alamofire7RequestC05firstB010Foundation10URLRequestVSgvp) `
First `URLRequest` created on behalf of the `Request`. May not be the first one actually executed.
#### Declaration
* `[lastRequest](#/s:9Alamofire7RequestC04lastB010Foundation10URLRequestVSgvp) `
Last `URLRequest` created on behalf of the `Request`.
#### Declaration
* `[request](#/s:9Alamofire7RequestC7request10Foundation10URLRequestVSgvp) `
Current `URLRequest` created on behalf of the `Request`.
#### Declaration
* `[performedRequests](#/s:9Alamofire7RequestC17performedRequestsSay10Foundation10URLRequestVGvp) `
`URLRequest`s from all of the `URLSessionTask`s executed on behalf of the `Request`. May be different from `[requests](../Classes/Request.html#/s:9Alamofire7RequestC8requestsSay10Foundation10URLRequestVGvp) ` due to `URLSession` manipulation.
#### Declaration
[](#/HTTPURLResponse)
### HTTPURLResponse
* `[response](#/s:9Alamofire7RequestC8responseSo17NSHTTPURLResponseCSgvp) `
`HTTPURLResponse` received from the server, if any. If the `Request` was retried, this is the response of the last `URLSessionTask`.
#### Declaration
[](#/Tasks)
### Tasks
* `[tasks](#/s:9Alamofire7RequestC5tasksSaySo16NSURLSessionTaskCGvp) `
All `URLSessionTask`s created on behalf of the `Request`.
#### Declaration
* `[firstTask](#/s:9Alamofire7RequestC9firstTaskSo012NSURLSessionD0CSgvp) `
First `URLSessionTask` created on behalf of the `Request`.
#### Declaration
* `[lastTask](#/s:9Alamofire7RequestC8lastTaskSo012NSURLSessionD0CSgvp) `
Last `URLSessionTask` created on behalf of the `Request`.
#### Declaration
* `[task](#/s:9Alamofire7RequestC4taskSo16NSURLSessionTaskCSgvp) `
Current `URLSessionTask` created on behalf of the `Request`.
#### Declaration
[](#/Metrics)
### Metrics
* `[allMetrics](#/s:9Alamofire7RequestC10allMetricsSaySo016NSURLSessionTaskD0CGvp) `
All `URLSessionTaskMetrics` gathered on behalf of the `Request`. Should correspond to the `[tasks](../Classes/Request.html#/s:9Alamofire7RequestC5tasksSaySo16NSURLSessionTaskCGvp) ` created.
#### Declaration
* `[firstMetrics](#/s:9Alamofire7RequestC12firstMetricsSo016NSURLSessionTaskD0CSgvp) `
First `URLSessionTaskMetrics` gathered on behalf of the `Request`.
#### Declaration
* `[lastMetrics](#/s:9Alamofire7RequestC11lastMetricsSo016NSURLSessionTaskD0CSgvp) `
Last `URLSessionTaskMetrics` gathered on behalf of the `Request`.
#### Declaration
* `[metrics](#/s:9Alamofire7RequestC7metricsSo23NSURLSessionTaskMetricsCSgvp) `
Current `URLSessionTaskMetrics` gathered on behalf of the `Request`.
#### Declaration
[](#/Retry%20Count)
### Retry Count
* `[retryCount](#/s:9Alamofire7RequestC10retryCountSivp) `
Number of times the `Request` has been retried.
#### Declaration
[](#/Error)
### Error
* `[error](#/s:9Alamofire7RequestC5errorAA7AFErrorOSgvp) `
`Error` returned from Alamofire internally, from the network request directly, or any validators executed.
#### Declaration
[](#/State)
### State
* `[cancel()](#/s:9Alamofire7RequestC6cancelACXDyF) `
Cancels the instance. Once cancelled, a `Request` can no longer be resumed or suspended.
#### Declaration
#### Return Value
The instance.
* `[suspend()](#/s:9Alamofire7RequestC7suspendACXDyF) `
Suspends the instance.
#### Declaration
#### Return Value
The instance.
* `[resume()](#/s:9Alamofire7RequestC6resumeACXDyF) `
Resumes the instance.
#### Declaration
#### Return Value
The instance.
[](#/Closure%20API)
### Closure API
* `[authenticate(username:password:persistence:)](#/s:9Alamofire7RequestC12authenticate8username8password11persistenceACXDSS_SSSo26NSURLCredentialPersistenceVtF) `
Associates a credential using the provided values with the instance.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_username_` | The username. |
| `_password_` | The password. |
| `_persistence_` | The `URLCredential.Persistence` for the created `URLCredential`. `.forSession` by default. |
#### Return Value
The instance.
* `[authenticate(with:)](#/s:9Alamofire7RequestC12authenticate4withACXDSo15NSURLCredentialC_tF) `
Associates the provided credential with the instance.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_credential_` | The `URLCredential`. |
#### Return Value
The instance.
* `[downloadProgress(queue:closure:)](#/s:9Alamofire7RequestC16downloadProgress5queue7closureACXDSo012OS_dispatch_E0C_ySo10NSProgressCctF) `
Sets a closure to be called periodically during the lifecycle of the instance as data is read from the server.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | The `DispatchQueue` to execute the closure on. `.main` by default. |
| `_closure_` | The closure to be executed periodically as data is read from the server. |
#### Return Value
The instance.
* `[uploadProgress(queue:closure:)](#/s:9Alamofire7RequestC14uploadProgress5queue7closureACXDSo012OS_dispatch_E0C_ySo10NSProgressCctF) `
Sets a closure to be called periodically during the lifecycle of the instance as data is sent to the server.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | The `DispatchQueue` to execute the closure on. `.main` by default. |
| `_closure_` | The closure to be executed periodically as data is sent to the server. |
#### Return Value
The instance.
[](#/Redirects)
### Redirects
* `[redirect(using:)](#/s:9Alamofire7RequestC8redirect5usingACXDAA15RedirectHandler_p_tF) `
Sets the redirect handler for the instance which will be used if a redirect response is encountered.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_handler_` | The `[RedirectHandler](../Protocols/RedirectHandler.html) `. |
#### Return Value
The instance.
[](#/Cached%20Responses)
### Cached Responses
* `[cacheResponse(using:)](#/s:9Alamofire7RequestC13cacheResponse5usingACXDAA06CachedD7Handler_p_tF) `
Sets the cached response handler for the `Request` which will be used when attempting to cache a response.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_handler_` | The `[CachedResponseHandler](../Protocols/CachedResponseHandler.html) `. |
#### Return Value
The instance.
[](#/Lifetime%20APIs)
### Lifetime APIs
* `[cURLDescription(on:calling:)](#/s:9Alamofire7RequestC15cURLDescription2on7callingACXDSo17OS_dispatch_queueC_ySSctF) `
Sets a handler to be called when the cURL description of the request is available.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | `DispatchQueue` on which `handler` will be called. |
| `_handler_` | Closure to be called when the cURL description is available. |
#### Return Value
The instance.
* `[cURLDescription(calling:)](#/s:9Alamofire7RequestC15cURLDescription7callingACXDySSc_tF) `
Sets a handler to be called when the cURL description of the request is available.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_handler_` | Closure to be called when the cURL description is available. Called on the instance’s `[underlyingQueue](../Classes/Request.html#/s:9Alamofire7RequestC15underlyingQueueSo17OS_dispatch_queueCvp) ` by default. |
#### Return Value
The instance.
* `[onURLRequestCreation(on:perform:)](#/s:9Alamofire7RequestC20onURLRequestCreation0C07performACXDSo17OS_dispatch_queueC_y10Foundation0D0VctF) `
Sets a closure to called whenever Alamofire creates a `URLRequest` for this instance.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | `DispatchQueue` on which `handler` will be called. `.main` by default. |
| `_handler_` | Closure to be called when a `URLRequest` is available. |
#### Return Value
The instance.
* `[onURLSessionTaskCreation(on:perform:)](#/s:9Alamofire7RequestC24onURLSessionTaskCreation0C07performACXDSo17OS_dispatch_queueC_ySo012NSURLSessionE0CctF) `
Sets a closure to be called whenever the instance creates a `URLSessionTask`.
#### Declaration
#### Parameters
| | |
| --- | --- |
| `_queue_` | `DispatchQueue` on which `handler` will be called. `.main` by default. |
| `_handler_` | Closure to be called when the `URLSessionTask` is available. |
#### Return Value
The instance.
* `[didResumeNotification](#/s:9Alamofire7RequestC21didResumeNotificationSo18NSNotificationNameavpZ) `
Posted when a `Request` is resumed. The `Notification` contains the resumed `Request`.
#### Declaration
* `[didSuspendNotification](#/s:9Alamofire7RequestC22didSuspendNotificationSo18NSNotificationNameavpZ) `
Posted when a `Request` is suspended. The `Notification` contains the suspended `Request`.
#### Declaration
* `[didCancelNotification](#/s:9Alamofire7RequestC21didCancelNotificationSo18NSNotificationNameavpZ) `
Posted when a `Request` is cancelled. The `Notification` contains the cancelled `Request`.
#### Declaration
* `[didFinishNotification](#/s:9Alamofire7RequestC21didFinishNotificationSo18NSNotificationNameavpZ) `
Posted when a `Request` is finished. The `Notification` contains the completed `Request`.
#### Declaration
* `[didResumeTaskNotification](#/s:9Alamofire7RequestC25didResumeTaskNotificationSo18NSNotificationNameavpZ) `
Posted when a `URLSessionTask` is resumed. The `Notification` contains the `Request` associated with the `URLSessionTask`.
#### Declaration
* `[didSuspendTaskNotification](#/s:9Alamofire7RequestC26didSuspendTaskNotificationSo18NSNotificationNameavpZ) `
Posted when a `URLSessionTask` is suspended. The `Notification` contains the `Request` associated with the `URLSessionTask`.
#### Declaration
* `[didCancelTaskNotification](#/s:9Alamofire7RequestC25didCancelTaskNotificationSo18NSNotificationNameavpZ) `
Posted when a `URLSessionTask` is cancelled. The `Notification` contains the `Request` associated with the `URLSessionTask`.
#### Declaration
* `[didCompleteTaskNotification](#/s:9Alamofire7RequestC27didCompleteTaskNotificationSo18NSNotificationNameavpZ) `
Posted when a `URLSessionTask` is completed. The `Notification` contains the `Request` associated with the `URLSessionTask`.
#### Declaration
* `[ResponseDisposition](#/s:9Alamofire7RequestC19ResponseDispositionO) `
Type indicating how a `[DataRequest](../Classes/DataRequest.html) ` or `[DataStreamRequest](../Classes/DataStreamRequest.html) ` should proceed after receiving an `HTTPURLResponse`.
[See more](../Classes/Request/ResponseDisposition.html)
#### Declaration
[](#/Protocol%20Conformances)
### Protocol Conformances
* `[==(_:_:)](#/s:SQ2eeoiySbx_xtFZ) `
#### Declaration
* `[hash(into:)](#/s:SH4hash4intoys6HasherVz_tF) `
#### Declaration
* `[description](#/s:9Alamofire7RequestC11descriptionSSvp) `
A textual representation of this instance, including the `[HTTPMethod](../Structs/HTTPMethod.html) ` and `URL` if the `URLRequest` has been created, as well as the response status code, if a response has been received.
#### Declaration
* `[cURLDescription()](#/s:9Alamofire7RequestC15cURLDescriptionSSyF) `
cURL representation of the instance.
#### Declaration
#### Return Value
The cURL equivalent of the instance.
[](#/Request%20Event%20Streams)
### Request Event Streams
* `[uploadProgress(bufferingPolicy:)](#/s:9Alamofire7RequestC14uploadProgress15bufferingPolicyAA8StreamOfVySo10NSProgressCGScS12ContinuationV09BufferingF0OyAI__G_tF) `
Creates a `[StreamOf