Initializer

init(url:statusCode:httpVersion:headerFields:)

Initializes an HTTP URL response object with a status code, protocol version, and response headers. HTTP URL応答オブジェクトをステータスコード、プロトコルバージョン、そしてレスポンスヘッダで初期化します。

Declaration 宣言

init?(url: URL, 
statusCode: Int, 
httpVersion HTTPVersion: String?, 
headerFields: [String : String]?)

Parameters パラメータ

url

The URL from which the response was generated. それから応答が生成されたURL。

statusCode

The HTTP status code to return (404, for example). See RFC 2616 for details. 返すことになるHTTP状態コード(例えば、404)。RFC 2616を詳細として見てください。

HTTPVersion

The version of the HTTP response as returned by the server. This is typically represented as "HTTP/1.1". HTTP応答のバージョン、サーバによって返されるままでの。これは概して "HTTP/1.1" のように表されます。

headerFields

A dictionary representing the keys and values from the server’s response header. サーバーの持つ応答ヘッダからのキーと値を表している辞書。

Return Value 戻り値

An initialized HTTPURLResponse object or nil if an error occurred during initialization. 初期化されたHTTPURLResponseオブジェクト、または初期化の間にエラーが発生したならばnil