     }
 }
 
+/// A `Body` that represents a form encoded HTTP request body.
 public struct FormEncodedBody: Body {
+    
+    /// The parameters dictionary to be encoded.
     public var parameters: Parameters
     
+    /// Initialize with a parameters dictionary.
+    /// 
+    /// The parameters do not have to be percent encoded.
     public init(parameters: Parameters) {
         self.parameters = parameters
     }
     
+    /// Returns "Content-Type": "application/x-www-form-urlencoded".
     public var header: Parameters? {
-        return [ "Content-Type" : "application/x-www-form-urlencoded" ]
+        return [ "Content-Type": "application/x-www-form-urlencoded" ]
     }
     
+    /// Returns the encapsulated parameters dictionary as form encoded `Data`.
     public var requestData: Data {
         return parameters.map { key, value in
             return "\(encode(key))=\(encode(value))"
         }.joined(separator: "&").data(using: .utf8)!
     }
     
+    /// add percent encoding to a string suitable for a form encoded request.
     func encode(_ string: String) -> String {
         guard let encoded = string.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else {
             fatalError("failed to encode param string: \(string)")

    case connect = "CONNECT"
}

public protocol Body {
    var header: Parameters? { get }
    var requestData: Data { get }
}


    }
}

/// A `Body` that represents a JSON encoded HTTP request body.
public struct JSONEncodedBody: Body {
    public let requestData: Data
    
    /// Initialize with a JSON object, an `Array` or a `Dictionary`.
    ///
    /// - throws: The error thrown by `JSONSerialization.data(withJSONObject:options:)`, if `jsonObject`
    /// cannot be encoded.
    public init(jsonObject: Any) throws {
        requestData = try JSONSerialization.data(withJSONObject: jsonObject, options: .prettyPrinted)
    }
    
    /// Returns "Content-Type": "application/json".
    public var header: Parameters? {
        return [ "Content-Type" : "application/json" ]
    }
}

/// A type that can transform itself into an `URLRequest`.
///
/// This protocol is adopted by `Request`, `URLRequest`, `URL` and `Call`.
public protocol URLRequestEncodable: CustomDebugStringConvertible {
    
    /// Returns an `URLRequest` configured with the data encapsulated by `self`.
    var urlRequest: URLRequest { get }
}

extension URLRequestEncodable {
    
    /// Returns the value returned by `cURLRepresentation`.
    public var debugDescription: String {
        return cURLRepresentation
    }
}

/// A type that encapsulates all data necessary to construct an `URLRequest`
/// suitable for a typical REST-API call.
/// 
/// You can (and should) use this instead of a plain `URLRequest`, because it's
/// usually much more convenient and easier to read.
public struct Request: URLRequestEncodable {
    public var method: HTTPMethod
    public var url: URL
    public var header: Parameters?
    public var body: Body?
    
    /// Creates a relative Request
    public init(_ method: HTTPMethod, _ path: String?=nil, query: Parameters?=nil, header: Parameters?=nil, body: Body?=nil) {
        self.init(method, url: URL(path: path, query: query), header: header, body: body)
    }
    
    /// Creates an absolute Request
    public init(_ method: HTTPMethod, url: URL, header: Parameters?=nil, body: Body?=nil) {
        self.method = method
        self.header = header
