Request: thuộc tính method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.

Note: This feature is available in Web Workers.

Thuộc tính chỉ đọc method của giao diện Request chứa phương thức của request (GET, POST, v.v.).

Giá trị

Một String biểu thị phương thức của request.

Ví dụ

Trong đoạn mã sau, chúng ta tạo một request mới bằng constructor Request() rồi lưu phương thức của request vào một biến:

js
const myRequest = new Request("flowers.jpg");
const myMethod = myRequest.method; // GET

Thông số kỹ thuật

Thông số kỹ thuật
Fetch
# ref-for-dom-request-method②

Tương thích trình duyệt

Xem thêm