Skip to content

Commit

Permalink
feat(method): add http method enum
Browse files Browse the repository at this point in the history
  • Loading branch information
TomokiMiyauci committed Mar 1, 2023
1 parent 8e95d41 commit 5e31439
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
27 changes: 27 additions & 0 deletions method.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2022-latest the httpland authors. All rights reserved. MIT license.
// This module is browser compatible.

/** Standard HTTP methods. */
export const enum Method {
/** RFC 9110, 9.3.1 */
Get = "GET",
/** RFC 9110, 9.3.2 */
Head = "HEAD",
/** RFC 9110, 9.3.3 */
Post = "POST",
/** RFC 9110, 9.3.4 */
Put = "PUT",
/** RFC 9110, 9.3.5 */
Delete = "DELETE",
/** RFC 9110, 9.3.6 */
Connect = "CONNECT",
/** RFC 9110, 9.3.7 */
Options = "OPTIONS",
/** RFC 9110, 9.3.8 */
Trace = "TRACE",
/** RFC 5789 */
Patch = "PATCH",
}

/** HTTP request method. */
export type HttpMethod = Uppercase<keyof typeof Method>;
3 changes: 2 additions & 1 deletion mod.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022-latest the httpland authors. All rights reserved. MIT license.
// This module is browser compatible.

export { equalsRequest, type HttpMethod, isRequest } from "./requests.ts";
export { equalsRequest, isRequest } from "./requests.ts";
export { type HttpHandler } from "./handlers.ts";
export {
equalsHeaders,
Expand All @@ -12,3 +12,4 @@ export {
parseFieldValue,
} from "./headers.ts";
export { equalsResponse, isResponse, safeResponse } from "./responses.ts";
export { type HttpMethod, Method } from "./method.ts";

0 comments on commit 5e31439

Please sign in to comment.