From 4142c142e7098598260c29220660981357b3bd67 Mon Sep 17 00:00:00 2001 From: Yosuke Ishikawa Date: Tue, 11 Apr 2017 05:17:16 +0900 Subject: [PATCH] Rename Request.Parser to Request.DataParser (cherry picked from commit 3593a025340b9ec3518480f97a3f0bc2cd41a58c) --- Sources/APIKit/Request.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/APIKit/Request.swift b/Sources/APIKit/Request.swift index a497daf..14e7af5 100644 --- a/Sources/APIKit/Request.swift +++ b/Sources/APIKit/Request.swift @@ -10,7 +10,7 @@ import Foundation public protocol Request { /// The response type associated with the request type. associatedtype Response - associatedtype Parser: DataParser + associatedtype DataParser: APIKit.DataParser /// The base URL. var baseURL: URL { get } @@ -41,7 +41,7 @@ public protocol Request { var headerFields: [String: String] { get } /// The parser object that states `Content-Type` to accept and parses response body. - var dataParser: Parser { get } + var dataParser: DataParser { get } /// Intercepts `URLRequest` which is created by `Request.buildURLRequest()`. If an error is /// thrown in this method, the result of `Session.send()` turns `.failure(.requestError(error))`. @@ -53,12 +53,12 @@ public protocol Request { /// The default implementation of this method is provided to throw `ResponseError.unacceptableStatusCode` /// if the HTTP status code is not in `200..<300`. /// - Throws: `Error` - func intercept(object: Parser.Parsed, urlResponse: HTTPURLResponse) throws -> Parser.Parsed + func intercept(object: DataParser.Parsed, urlResponse: HTTPURLResponse) throws -> DataParser.Parsed /// Build `Response` instance from raw response object. This method is called after /// `intercept(object:urlResponse:)` if it does not throw any error. /// - Throws: `Error` - func response(from object: Parser.Parsed, urlResponse: HTTPURLResponse) throws -> Response + func response(from object: DataParser.Parsed, urlResponse: HTTPURLResponse) throws -> Response } public extension Request { @@ -90,7 +90,7 @@ public extension Request { return urlRequest } - func intercept(object: Parser.Parsed, urlResponse: HTTPURLResponse) throws -> Parser.Parsed { + func intercept(object: DataParser.Parsed, urlResponse: HTTPURLResponse) throws -> DataParser.Parsed { guard 200..<300 ~= urlResponse.statusCode else { throw ResponseError.unacceptableStatusCode(urlResponse.statusCode) }