본문으로 건너뛰기

Response:getHeader()

이름으로 응답 헤더 하나를 읽습니다.

시그니처​

getHeader(name: string): string

매개변수​

매개변수유형설명
namestring헤더 이름, 대소문자 구분 없음

반환값

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 이상