Request: method プロパティ
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2017年3月.
メモ: この機能はウェブワーカー内で利用可能です。
method
は Request
インターフェイスの読み取り専用プロパティで、このリクエストのメソッド(GET
、POST
など)を保持します。
値
リクエストメソッドを示す文字列です。
例
次のスニペットは、Request.Request()
コンストラクターを使って(スクリプトと同じディレクトリーにある画像ファイルのために)新しいリクエストを生成してから、リクエストメソッドを変数に保存しています。
js
const myRequest = new Request("flowers.jpg");
const myMethod = myRequest.method; // GET
仕様書
Specification |
---|
Fetch> # ref-for-dom-request-method②> |
ブラウザーの互換性
Loading…