Skip to content

Commit 8176b16

Browse files
committed
Remove AlamofireHTTPClient
1 parent 09f5cfb commit 8176b16

File tree

9 files changed

+24
-111
lines changed

9 files changed

+24
-111
lines changed

Cartfile

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
github "Alamofire/Alamofire" ~> 5.1
21
github "mxcl/PromiseKit" ~> 6.13

Cartfile.resolved

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
github "Alamofire/Alamofire" "5.4.3"
21
github "mxcl/PromiseKit" "6.15.3"

Package.resolved

-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
{
22
"object": {
33
"pins": [
4-
{
5-
"package": "Alamofire",
6-
"repositoryURL": "https://github.com/Alamofire/Alamofire.git",
7-
"state": {
8-
"branch": null,
9-
"revision": "fca036f7aeca07124067cb6e0c12b0ad6359e3d4",
10-
"version": "5.1.0"
11-
}
12-
},
134
{
145
"package": "PromiseKit",
156
"repositoryURL": "https://github.com/mxcl/PromiseKit.git",

Package.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ let package = Package(
1818
),
1919
],
2020
dependencies: [
21-
.package(url: "https://github.com/Alamofire/Alamofire.git", from: "5.1.0"),
2221
.package(url: "https://github.com/mxcl/PromiseKit.git", from: "6.13.1")
2322
],
2423
targets: [
2524
.target(
2625
name: "SwiftJSONRPC",
27-
dependencies: ["Alamofire", "PromiseKit"],
26+
dependencies: ["PromiseKit"],
2827
path: "Sources"
2928
),
3029
.testTarget(

Sources/SwiftJSONRPC/RequestExecutor/HTTP/Client/AlamofireHTTPClient.swift

-78
This file was deleted.

Sources/SwiftJSONRPC/RequestExecutor/HTTP/Client/HTTPRequest.swift

+6-17
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88

99
import Foundation
1010

11-
// ----------------------------------------------------------------------------
11+
public struct HTTPRequest {
1212

13-
public struct HTTPRequest
14-
{
15-
// MARK: - Properties
13+
// MARK: - Properties
1614

1715
public var method: HTTPMethod
1816

@@ -24,26 +22,19 @@ public struct HTTPRequest
2422

2523
}
2624

27-
// ----------------------------------------------------------------------------
25+
extension HTTPRequest: Equatable {
2826

29-
extension HTTPRequest: Equatable
30-
{
31-
// MARK: - Functions
27+
// MARK: - Functions
3228

33-
public static func ==(lhs: HTTPRequest, rhs: HTTPRequest) -> Bool
34-
{
29+
public static func ==(lhs: HTTPRequest, rhs: HTTPRequest) -> Bool {
3530
return lhs.method == rhs.method &&
3631
lhs.url == rhs.url &&
3732
lhs.headers == rhs.headers &&
3833
lhs.body == rhs.body
3934
}
40-
4135
}
4236

43-
// ----------------------------------------------------------------------------
44-
45-
public enum HTTPMethod: String
46-
{
37+
public enum HTTPMethod: String {
4738
case options = "OPTIONS"
4839
case get = "GET"
4940
case head = "HEAD"
@@ -54,5 +45,3 @@ public enum HTTPMethod: String
5445
case trace = "TRACE"
5546
case connect = "CONNECT"
5647
}
57-
58-
// ----------------------------------------------------------------------------

Sources/SwiftJSONRPC/RequestExecutor/HTTP/Client/URLSessionHTTPClient.swift

+15
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,18 @@ struct URLSessionHTTPClient: HTTPClient {
6464
class NoResponseDataError: HTTPClientError { }
6565

6666
}
67+
68+
extension HTTPRequest {
69+
70+
// MARK: - Functions
71+
72+
func asURLRequest() -> URLRequest {
73+
var request = URLRequest(url: self.url)
74+
75+
request.httpMethod = method.rawValue
76+
request.allHTTPHeaderFields = headers
77+
request.httpBody = body
78+
79+
return request
80+
}
81+
}

SwiftJSONRPC.podspec

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = "SwiftJSONRPC"
33
s.version = "0.8.0"
4-
s.summary = "Swift JSON-RPC client based on Alamofire"
4+
s.summary = "Swift JSON-RPC 2.0 client"
55
s.homepage = "https://github.com/kolyasev/SwiftJSONRPC"
66
s.license = 'MIT'
77
s.author = { "Denis Kolyasev" => "[email protected]" }
@@ -14,7 +14,6 @@ Pod::Spec.new do |s|
1414
s.source_files = 'Sources/**/*.swift'
1515

1616
s.frameworks = 'Foundation'
17-
s.dependency 'Alamofire', '~> 5.1'
1817
s.dependency 'PromiseKit', '~> 6.13'
1918

2019
# TODO: Convert to Swift 3.x

Tests/HTTPRequestTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final class HTTPRequestTests: XCTestCase {
2525
let request = HTTPRequest(method: method, url: url, headers: headers, body: body)
2626

2727
// When
28-
let urlRequest: URLRequest! = try? request.asURLRequest()
28+
let urlRequest: URLRequest! = request.asURLRequest()
2929

3030
// Then
3131
XCTAssertNotNil(urlRequest)

0 commit comments

Comments
 (0)