-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description As per the title. ## Related Issue Closes #6
- Loading branch information
1 parent
d3a11d0
commit 28bac49
Showing
4 changed files
with
35 additions
and
12 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,23 @@ | ||
import Foundation | ||
|
||
/// Method of an HTTP request. | ||
/// The source of a request's semantics. | ||
/// | ||
///[Reference](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods). | ||
public enum HTTPMethod: String { | ||
case get = "GET" | ||
/// Transfer a current representation of the target resource. | ||
case get = "GET" | ||
/// Same as GET, but do not transfer the response content. | ||
case head = "HEAD" | ||
/// Perform resource-specific processing on the request content. | ||
case post = "POST" | ||
/// Replace all current representations of the target resource with the request content. | ||
case put = "PUT" | ||
/// Remove all current representations of the target resource. | ||
case delete = "DELETE" | ||
/// Establish a tunnel to the server identified by the target resource. | ||
case connect = "CONNECT" | ||
/// Describe the communication options for the target resource. | ||
case options = "OPTIONS" | ||
/// Perform a message loop-back test along the path to the target resource. | ||
case trace = "TRACE" | ||
} |
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,15 @@ | ||
import NetworkAPI | ||
import XCTest | ||
|
||
final class HTTPMethodTests: XCTestCase { | ||
func testRawValue_whenCalled_shouldReturnExpectedValue() { | ||
XCTAssertEqual(HTTPMethod.get.rawValue, "GET") | ||
XCTAssertEqual(HTTPMethod.head.rawValue, "HEAD") | ||
XCTAssertEqual(HTTPMethod.post.rawValue, "POST") | ||
XCTAssertEqual(HTTPMethod.put.rawValue, "PUT") | ||
XCTAssertEqual(HTTPMethod.delete.rawValue, "DELETE") | ||
XCTAssertEqual(HTTPMethod.connect.rawValue, "CONNECT") | ||
XCTAssertEqual(HTTPMethod.options.rawValue, "OPTIONS") | ||
XCTAssertEqual(HTTPMethod.trace.rawValue, "TRACE") | ||
} | ||
} |