---
title: HTTPURLResponse
framework: foundation
role: symbol
role_heading: Class
path: foundation/httpurlresponse
---

# HTTPURLResponse

The metadata associated with the response to an HTTP protocol URL load request.

## Declaration

```swift
class HTTPURLResponse
```

## Overview

Overview The HTTPURLResponse class is a subclass of URLResponse that provides methods for accessing information specific to HTTP protocol responses. Whenever you make HTTP URL load requests, any response objects you get back from the URLSession, NSURLConnection, or NSURLDownload class are instances of the HTTPURLResponse class.

## Topics

### Initializing a response object

- [init(url:statusCode:httpVersion:headerFields:)](foundation/httpurlresponse/init(url:statuscode:httpversion:headerfields:)-21j4x.md)

### Getting HTTP response headers

- [allHeaderFields](foundation/httpurlresponse/allheaderfields.md)
- [value(forHTTPHeaderField:)](foundation/httpurlresponse/value(forhttpheaderfield:).md)

### Getting response status codes

- [localizedString(forStatusCode:)](foundation/httpurlresponse/localizedstring(forstatuscode:).md)
- [statusCode](foundation/httpurlresponse/statuscode.md)

### Initializers

- [init(URL:statusCode:HTTPVersion:headerFields:)](foundation/httpurlresponse/init(url:statuscode:httpversion:headerfields:)-3kiww.md)

## Relationships

### Inherits From

- [URLResponse](foundation/urlresponse.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Requests and responses

- [URLRequest](foundation/urlrequest.md)
- [NSURLRequest](foundation/nsurlrequest.md)
- [NSMutableURLRequest](foundation/nsmutableurlrequest.md)
- [URLResponse](foundation/urlresponse.md)
