문법
HttpGet(context: DataModel, url: string, cache?: boolean | number): string인수
| 이름 | 타입 | 설명 |
|---|---|---|
context | DataModel | Method-call self value. Use game:HttpGet(url, cache) or game:HttpGetAsync(url, cache). |
url | string | URL string to request. |
cache? | boolean | number | Optional cache control. true or numeric 1 enables the URL cache. |
반환값
| 이름 | 타입 | 설명 |
|---|---|---|
body | string | Downloaded response body string, cached body string, or an empty string when the request cannot be opened. |
설명
Performs a GET request for game:HttpGet(url, cache) or game:HttpGetAsync(url, cache) and returns the response body string. The URL must pass Real's URL restrictions.
3개 파라미터로 호출합니다: context, url, cache. 인수 표는 필수 값과 동작을 조정하는 값을 설명합니다.
body (string)을 반환합니다. 반환 표를 사용해 성공 값, nil 결과, 복구 가능한 오류를 구분하세요.
예제
Run a DataModel-style GET request and return the response body string.
local body = game:HttpGet("https://example.com", true)
print(body)