Skip to content

Commit 1ed7013

Browse files
authored
Merge pull request #1 from gligorkot/ignore_base_url_support
adding support for ignoreBaseURL
2 parents 4ba2eef + 51c40cf commit 1ed7013

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

Classes/Core/Networking.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,12 @@ extension Networking {
6262
}
6363

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

Classes/Protocol/API.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
public protocol APIType {
1010
var authenticated: Bool { get }
11+
var ignoreBaseURL: Bool { get }
1112
}
1213

1314
// used for sample data responses in Target objects

GKNetworkingKit.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = 'GKNetworkingKit'
4-
s.version = '1.1.0'
4+
s.version = '1.2.0'
55
s.summary = 'GKNetworkingKit framework.'
66
s.description = <<-DESC
77
* GKNetworkingKit framework

GKNetworkingKitExample/GKNetworkingKitTests/NetworkingKitTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ final class API: TargetType, APIType {
5858
var authenticated: Bool {
5959
return true
6060
}
61+
62+
var ignoreBaseURL: Bool {
63+
return false
64+
}
6165
}
6266

6367
final class NotDebugConfig: DebugProtocol {

0 commit comments

Comments
 (0)