-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
11 changed files
with
94 additions
and
86 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import Foundation | ||
|
||
/// A path represents a path a request can query to | ||
/// | ||
/// You can create paths using plain String, for instance: | ||
/// ```swift | ||
/// extension Path { | ||
/// static let user = "v1/users" | ||
/// } | ||
/// | ||
/// If you want to regroup a set of paths you can use your own "namespace" and add a forward declaration in `Path`. | ||
/// Adding a declaration provide autocompletion when using it in `Request`. | ||
/// ```swift | ||
/// enum MyPaths { | ||
/// static let user: Path = "v1/users" | ||
/// } | ||
/// | ||
/// extension Path { | ||
/// static let myPaths = MyPaths.self | ||
/// } | ||
/// | ||
/// let user: Path = .myPaths.user | ||
/// ``` | ||
public struct Path: Equatable, ExpressibleByStringLiteral, ExpressibleByStringInterpolation { | ||
/// relative path | ||
public let value: String | ||
|
||
init(value: String) { | ||
self.value = value | ||
} | ||
|
||
public init(stringLiteral value: StringLiteralType) { | ||
self.init(value: value) | ||
} | ||
|
||
public init(stringInterpolation: DefaultStringInterpolation) { | ||
self.init(value: stringInterpolation.description) | ||
} | ||
|
||
public static func ==(lhs: Path, rhs: String) -> Bool { | ||
lhs.value == rhs | ||
} | ||
} | ||
|
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
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
2 changes: 1 addition & 1 deletion
2
Sources/SimpleHTTPFoundation/Foundation/URLRequest/URLRequest+URL.swift
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
2 changes: 1 addition & 1 deletion
2
Tests/SimpleHTTPFoundationTests/Foundation/URLRequest/URLRequestTests+URL.swift
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
2 changes: 1 addition & 1 deletion
2
Tests/SimpleHTTPFoundationTests/Foundation/URLRequest/URLRequestsTests+Encode.swift
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
2 changes: 1 addition & 1 deletion
2
Tests/SimpleHTTPFoundationTests/Foundation/URLResponseValidateTests.swift
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
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
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