Last active
February 12, 2017 05:30
-
-
Save fmo91/66bca796843d1439ad197e96fd9adfc8 to your computer and use it in GitHub Desktop.
Sample implementation of a network Request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Request.swift | |
// | |
// Created by Fernando Ortiz on 2/12/17. | |
// | |
import Foundation | |
enum HTTPMethod: String { | |
case get, post, put, patch, delete | |
} | |
protocol Request { | |
var path : String { get } | |
var method : HTTPMethod { get } | |
var bodyParams : [String: Any]? { get } | |
var headers : [String: String]? { get } | |
} | |
extension Request { | |
var method : HTTPMethod { return .get } | |
var bodyParams : [String: Any]? { return nil } | |
var headers : [String: String]? { return nil } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment