Skip to Content
Drash v3 is in beta. APIs may change.
ReferenceCoreHTTPRequestMethod

Method

The nine HTTP methods a resource can implement, as string constants.

import { Method } from "@drashland/drash/core/http/request/Method.js"; Method.GET; // "GET"

Values

KeyValue
CONNECTCONNECT
DELETEDELETE
GETGET
HEADHEAD
OPTIONSOPTIONS
PATCHPATCH
POSTPOST
PUTPUT
TRACETRACE

Key and value are identical for every entry. The constant exists for the type it produces, not for the indirection.

Type

import type { RequestMethod } from "@drashland/drash/core/types/RequestMethod.js"; // "CONNECT" | "DELETE" | "GET" | ...

RequestMethod is derived from Method, so the two cannot drift apart.

Notes

This list is the whole surface a resource can implement. Resource defines exactly these nine methods.

The chain’s ResourceCaller uppercases the incoming method and calls resource[method] directly. A request carrying a method outside this set resolves to undefined and fails with a TypeError rather than an HTTPError, so it does not arrive in your .catch() block as a tidy status — see Error Handling.

Last updated on