Web APIs

Request.method

Try the free JavaScript compiler

Expose the request method string after the constructor normalizes standard methods. Constructing a Request does not send it. Example console output: POST.

Formal Syntax & Structure

javascript syntaxjavascript
request.method

Return Value

string

HTTP method.

Working Example

Example Snippetjavascript
const r=new Request("https://example.invalid/items",{method:"post",body:"x"}); console.log(r.method);
JavaScript Reference