File tree Expand file tree Collapse file tree 13 files changed +368
-88
lines changed
Expand file tree Collapse file tree 13 files changed +368
-88
lines changed Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+
9+ env :
10+ DEVELOPER_DIR : /Applications/Xcode_12.4.app
11+
12+ jobs :
13+ build :
14+ runs-on : macOS-latest
15+ steps :
16+ - uses : actions/checkout@v2
17+ - name : Build
18+ run : swift build -v
19+
20+ test :
21+ runs-on : macOS-latest
22+ steps :
23+ - uses : actions/checkout@v2
24+ - name : Test
25+ run : swift test -v
26+
Original file line number Diff line number Diff line change 1- # Xcode
2- #
3- # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
1+ .DS_Store
2+ /.build
3+ /Packages
4+ /* .xcodeproj
5+ .swiftpm
6+ . * .sw ?
47
5- # # User settings
6- xcuserdata /
8+ # Ruby
9+ .ruby-version
10+ vendor
711
8- # # compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
9- * .xcscmblueprint
10- * .xccheckout
11-
12- # # compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
13- build /
14- DerivedData /
15- * .moved-aside
16- * .pbxuser
17- ! default.pbxuser
18- * .mode1v3
19- ! default.mode1v3
20- * .mode2v3
21- ! default.mode2v3
22- * .perspectivev3
23- ! default.perspectivev3
24-
25- # # Obj-C/Swift specific
26- * .hmap
27-
28- # # App packaging
29- * .ipa
30- * .dSYM.zip
31- * .dSYM
32-
33- # # Playgrounds
34- timeline.xctimeline
35- playground.xcworkspace
36-
37- # Swift Package Manager
38- #
39- # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
40- # Packages/
41- # Package.pins
42- # Package.resolved
43- # *.xcodeproj
44- #
45- # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
46- # hence it is not needed unless you have added a package configuration file to your project
47- # .swiftpm
48-
49- .build /
50-
51- # CocoaPods
52- #
53- # We recommend against adding the Pods directory to your .gitignore. However
54- # you should judge for yourself, the pros and cons are mentioned at:
55- # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
56- #
57- # Pods/
58- #
59- # Add this line if you want to avoid checking in source code from the Xcode workspace
60- # *.xcworkspace
61-
62- # Carthage
63- #
64- # Add this line if you want to avoid checking in source code from Carthage dependencies.
65- # Carthage/Checkouts
66-
67- Carthage /Build /
68-
69- # Accio dependency management
70- Dependencies /
71- .accio /
72-
73- # fastlane
74- #
75- # It is recommended to not store the screenshots in the git repo.
76- # Instead, use fastlane to re-generate the screenshots whenever they are needed.
77- # For more information about the recommended setup visit:
78- # https://docs.fastlane.tools/best-practices/source-control/#source-control
79-
80- fastlane /report.xml
81- fastlane /Preview.html
82- fastlane /screenshots /** /* .png
83- fastlane /test_output
84-
85- # Code Injection
86- #
87- # After new code Injection tools there's a generated folder /iOSInjectionProject
88- # https://github.com/johnno1962/injectionforxcode
89-
90- iOSInjectionProject /
Original file line number Diff line number Diff line change 1+ // swift-tools-version:5.3
2+
3+ import PackageDescription
4+
5+ let package = Package (
6+ name: " HTTPClient " ,
7+ platforms: [
8+ . iOS( . v8) ,
9+ . macOS( . v10_10) ,
10+ . tvOS( . v9) ,
11+ . watchOS( . v2) ,
12+ ] ,
13+ products: [
14+ . library(
15+ name: " HTTPClient " ,
16+ targets: [ " HTTPClient " ] ) ,
17+ ] ,
18+ dependencies: [
19+ ] ,
20+ targets: [
21+ . target(
22+ name: " HTTPClient " ,
23+ dependencies: [ ] ) ,
24+ . testTarget(
25+ name: " HTTPClientTests " ,
26+ dependencies: [ " HTTPClient " ] ) ,
27+ ]
28+ )
Original file line number Diff line number Diff line change 11# swift-http-client
2+
3+ [ ![ CI] ( https://github.com/uhooi/swift-http-client/actions/workflows/main.yml/badge.svg?branch=main )] ( https://github.com/uhooi/swift-http-client/actions/workflows/main.yml )
4+ [ ![ Release] ( https://img.shields.io/github/v/release/uhooi/swift-http-client )] ( https://github.com/uhooi/swift-http-client/releases/latest )
5+ [ ![ License] ( https://img.shields.io/github/license/uhooi/swift-http-client )] ( https://github.com/uhooi/swift-http-client/blob/main/LICENSE )
6+ [ ![ Twitter] ( https://img.shields.io/twitter/follow/the_uhooi?style=social )] ( https://twitter.com/the_uhooi )
7+
28Communicate via HTTP easily in Swift.
9+
10+ ## Table of Contents
11+
12+ - [ Installation] ( #installation )
13+ - [ How to use] ( #how-to-use )
14+ - [ Contribution] ( #contribution )
15+
16+ ## Installation
17+
18+ ### Swift Package Manager (Recommended)
19+
20+ #### Package
21+
22+ TBD
23+
24+ #### Xcode
25+
26+ TBD
27+
28+ ### CocoaPods
29+
30+ TBD
31+
32+ ### Carthage
33+
34+ TBD
35+
36+ ## How to use
37+
38+ You can just import ` HTTPClient ` to use it.
39+
40+ ## Contribution
41+
42+ I would be happy if you contribute :)
43+
44+ - [ New issue] ( https://github.com/uhooi/swift-http-client/issues/new )
45+ - [ New pull request] ( https://github.com/uhooi/swift-http-client/compare )
Original file line number Diff line number Diff line change 1+ /// Content-Type.
2+ public enum ContentType : String {
3+ case applicationJson = " application/json "
4+ }
Original file line number Diff line number Diff line change 1+ /// HTTP header field.
2+ public enum HTTPHeaderField : String {
3+ case contentType = " Content-Type "
4+ case authorization = " Authorization "
5+ }
Original file line number Diff line number Diff line change 1+ /// HTTP method.
2+ public enum HTTPMethod : String {
3+ case get = " GET "
4+ case post = " POST "
5+ case put = " PUT "
6+ }
Original file line number Diff line number Diff line change 1+ /// Request error.
2+ public enum RequestError : Error {
3+ case invalidUrl
4+ case invalidData
5+ case invalidResponse
6+ case redirection( _ statusCode: Int )
7+ case clientError( _ statusCode: Int )
8+ case serverError( _ statusCode: Int )
9+ case invalidStatusCode( _ statusCode: Int )
10+ }
You can’t perform that action at this time.
0 commit comments