Skip to content

Commit

Permalink
Merge pull request #1 from gligorkot/ignore_base_url_support
Browse files Browse the repository at this point in the history
adding support for ignoreBaseURL
  • Loading branch information
gligorkot authored Mar 17, 2019
2 parents 4ba2eef + 51c40cf commit 1ed7013
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Classes/Core/Networking.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ extension Networking {
}

private static func endpoint<T>(_ target: T, stubResponseClosure: @escaping () -> EndpointSampleResponse, httpHeaderFields: [String : String]?) -> Endpoint where T: TargetType, T: APIType {
let url = target.baseURL.appendingPathComponent(target.path).absoluteString
let url: String
if target.ignoreBaseURL {
url = target.path
} else {
url = target.baseURL.appendingPathComponent(target.path).absoluteString
}
return Endpoint(url: url, sampleResponseClosure: stubResponseClosure, method: target.method, task: target.task, httpHeaderFields: httpHeaderFields)
}

Expand Down
1 change: 1 addition & 0 deletions Classes/Protocol/API.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

public protocol APIType {
var authenticated: Bool { get }
var ignoreBaseURL: Bool { get }
}

// used for sample data responses in Target objects
Expand Down
2 changes: 1 addition & 1 deletion GKNetworkingKit.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = 'GKNetworkingKit'
s.version = '1.1.0'
s.version = '1.2.0'
s.summary = 'GKNetworkingKit framework.'
s.description = <<-DESC
* GKNetworkingKit framework
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ final class API: TargetType, APIType {
var authenticated: Bool {
return true
}

var ignoreBaseURL: Bool {
return false
}
}

final class NotDebugConfig: DebugProtocol {
Expand Down

0 comments on commit 1ed7013

Please sign in to comment.