Response:getHeader()
名前を指定してレスポンスヘッダーを1つ読み取ります。
シグネチャ
getHeader(name: string): string
パラメータ
| パラメータ | 型 | 説明 |
|---|---|---|
| name | string | ヘッダー名。大文字と小文字を区別しません |
戻り値
string - ヘッダーの値。レスポンスに含まれていない場合は nil。
例
local response = Request("https://api.example.com/data"):get()
local type = response:getHeader("Content-Type")
toast("Server sent " .. (type or "no content type"))
対応バージョン: 1.0.0.37 以上