Add RFC links to status codes and methods as well

This commit is contained in:
Guoye Zhang committed 2023-09-06 15:42:38 -07:00
1 parent b45c5cf7c8
commit d17b0cf651
2 files changed
+166

No files matched your search

+26
View File
@@ -315,23 +315,49 @@ extension HTTPRequest: Codable {
extension HTTPRequest.Method {
/// GET
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var get: Self { .init(unchecked: "GET") }
/// HEAD
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var head: Self { .init(unchecked: "HEAD") }
/// POST
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var post: Self { .init(unchecked: "POST") }
/// PUT
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var put: Self { .init(unchecked: "PUT") }
/// DELETE
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var delete: Self { .init(unchecked: "DELETE") }
/// CONNECT
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var connect: Self { .init(unchecked: "CONNECT") }
/// OPTIONS
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var options: Self { .init(unchecked: "OPTIONS") }
/// TRACE
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var trace: Self { .init(unchecked: "TRACE") }
/// PATCH
///
/// https://www.rfc-editor.org/rfc/rfc5789.html
public static var patch: Self { .init(unchecked: "PATCH") }
/// CONNECT-UDP
static var connectUDP: Self { .init(unchecked: "CONNECT-UDP") }
}
+140
View File
@@ -272,113 +272,253 @@ extension HTTPResponse.Status {
// MARK: 1xx
/// 100 Continue
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var `continue`: Self { .init(uncheckedCode: 100, reasonPhrase: "Continue") }
/// 101 Switching Protocols
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var switchingProtocols: Self { .init(uncheckedCode: 101, reasonPhrase: "Switching Protocols") }
/// 103 Early Hints
///
/// https://www.rfc-editor.org/rfc/rfc8297.html
public static var earlyHints: Self { .init(uncheckedCode: 103, reasonPhrase: "Early Hints") }
// MARK: 2xx
/// 200 OK
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var ok: Self { .init(uncheckedCode: 200, reasonPhrase: "OK") }
/// 201 Created
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var created: Self { .init(uncheckedCode: 201, reasonPhrase: "Created") }
/// 202 Accepted
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var accepted: Self { .init(uncheckedCode: 202, reasonPhrase: "Accepted") }
/// 203 Non-Authoritative Information
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var nonAuthoritativeInformation: Self { .init(uncheckedCode: 203, reasonPhrase: "Non-Authoritative Information") }
/// 204 No Content
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var noContent: Self { .init(uncheckedCode: 204, reasonPhrase: "No Content") }
/// 205 Reset Content
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var resetContent: Self { .init(uncheckedCode: 205, reasonPhrase: "Reset Content") }
/// 206 Partial Content
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var partialContent: Self { .init(uncheckedCode: 206, reasonPhrase: "Partial Content") }
// MARK: 3xx
/// 300 Multiple Choices
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var multipleChoices: Self { .init(uncheckedCode: 300, reasonPhrase: "Multiple Choices") }
/// 301 Moved Permanently
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var movedPermanently: Self { .init(uncheckedCode: 301, reasonPhrase: "Moved Permanently") }
/// 302 Found
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var found: Self { .init(uncheckedCode: 302, reasonPhrase: "Found") }
/// 303 See Other
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var seeOther: Self { .init(uncheckedCode: 303, reasonPhrase: "See Other") }
/// 304 Not Modified
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var notModified: Self { .init(uncheckedCode: 304, reasonPhrase: "Not Modified") }
/// 307 Temporary Redirect
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var temporaryRedirect: Self { .init(uncheckedCode: 307, reasonPhrase: "Temporary Redirect") }
/// 308 Permanent Redirect
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var permanentRedirect: Self { .init(uncheckedCode: 308, reasonPhrase: "Permanent Redirect") }
// MARK: 4xx
/// 400 Bad Request
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var badRequest: Self { .init(uncheckedCode: 400, reasonPhrase: "Bad Request") }
/// 401 Unauthorized
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var unauthorized: Self { .init(uncheckedCode: 401, reasonPhrase: "Unauthorized") }
/// 403 Forbidden
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var forbidden: Self { .init(uncheckedCode: 403, reasonPhrase: "Forbidden") }
/// 404 Not Found
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var notFound: Self { .init(uncheckedCode: 404, reasonPhrase: "Not Found") }
/// 405 Method Not Allowed
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var methodNotAllowed: Self { .init(uncheckedCode: 405, reasonPhrase: "Method Not Allowed") }
/// 406 Not Acceptable
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var notAcceptable: Self { .init(uncheckedCode: 406, reasonPhrase: "Not Acceptable") }
/// 407 Proxy Authentication Required
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var proxyAuthenticationRequired: Self { .init(uncheckedCode: 407, reasonPhrase: "Proxy Authentication Required") }
/// 408 Request Timeout
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var requestTimeout: Self { .init(uncheckedCode: 408, reasonPhrase: "Request Timeout") }
/// 409 Conflict
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var conflict: Self { .init(uncheckedCode: 409, reasonPhrase: "Conflict") }
/// 410 Gone
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var gone: Self { .init(uncheckedCode: 410, reasonPhrase: "Gone") }
/// 411 Length Required
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var lengthRequired: Self { .init(uncheckedCode: 411, reasonPhrase: "Length Required") }
/// 412 Precondition Failed
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var preconditionFailed: Self { .init(uncheckedCode: 412, reasonPhrase: "Precondition Failed") }
/// 413 Content Too Large
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var contentTooLarge: Self { .init(uncheckedCode: 413, reasonPhrase: "Content Too Large") }
/// 414 URI Too Long
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var uriTooLong: Self { .init(uncheckedCode: 414, reasonPhrase: "URI Too Long") }
/// 415 Unsupported Media Type
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var unsupportedMediaType: Self { .init(uncheckedCode: 415, reasonPhrase: "Unsupported Media Type") }
/// 416 Range Not Satisfiable
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var rangeNotSatisfiable: Self { .init(uncheckedCode: 416, reasonPhrase: "Range Not Satisfiable") }
/// 417 Expectation Failed
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var expectationFailed: Self { .init(uncheckedCode: 417, reasonPhrase: "Expectation Failed") }
/// 421 Misdirected Request
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var misdirectedRequest: Self { .init(uncheckedCode: 421, reasonPhrase: "Misdirected Request") }
/// 422 Unprocessable Content
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var unprocessableContent: Self { .init(uncheckedCode: 422, reasonPhrase: "Unprocessable Content") }
/// 425 Too Early
public static var tooEarly: Self { .init(uncheckedCode: 425, reasonPhrase: "Too Early") }
/// 426 Upgrade Required
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var upgradeRequired: Self { .init(uncheckedCode: 426, reasonPhrase: "Upgrade Required") }
/// 428 Precondition Required
///
/// https://www.rfc-editor.org/rfc/rfc6585.html
public static var preconditionRequired: Self { .init(uncheckedCode: 428, reasonPhrase: "Precondition Required") }
/// 429 Too Many Requests
///
/// https://www.rfc-editor.org/rfc/rfc6585.html
public static var tooManyRequests: Self { .init(uncheckedCode: 429, reasonPhrase: "Too Many Requests") }
/// 431 Request Header Fields Too Large
///
/// https://www.rfc-editor.org/rfc/rfc6585.html
public static var requestHeaderFieldsTooLarge: Self { .init(uncheckedCode: 431, reasonPhrase: "Request Header Fields Too Large") }
/// 451 Unavailable For Legal Reasons
///
/// https://www.rfc-editor.org/rfc/rfc7725.html
public static var unavailableForLegalReasons: Self { .init(uncheckedCode: 451, reasonPhrase: "Unavailable For Legal Reasons") }
// MARK: 5xx
/// 500 Internal Server Error
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var internalServerError: Self { .init(uncheckedCode: 500, reasonPhrase: "Internal Server Error") }
/// 501 Not Implemented
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var notImplemented: Self { .init(uncheckedCode: 501, reasonPhrase: "Not Implemented") }
/// 502 Bad Gateway
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var badGateway: Self { .init(uncheckedCode: 502, reasonPhrase: "Bad Gateway") }
/// 503 Service Unavailable
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var serviceUnavailable: Self { .init(uncheckedCode: 503, reasonPhrase: "Service Unavailable") }
/// 504 Gateway Timeout
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var gatewayTimeout: Self { .init(uncheckedCode: 504, reasonPhrase: "Gateway Timeout") }
/// 505 HTTP Version Not Supported
///
/// https://www.rfc-editor.org/rfc/rfc9110.html
public static var httpVersionNotSupported: Self { .init(uncheckedCode: 505, reasonPhrase: "HTTP Version Not Supported") }
/// 511 Network Authentication Required
///
/// https://www.rfc-editor.org/rfc/rfc6585.html
public static var networkAuthenticationRequired: Self { .init(uncheckedCode: 511, reasonPhrase: "Network Authentication Required") }
}