request의 필드와 메서드
필드는 값에 관한 단순한 정보로, 대괄호 없이 점으로 읽어요: $value.name. 메서드는 인수를 받거나 작업을 수행하며, ->로 호출하거나 $value->name(arguments)처럼 값을 파이프로 넘겨서 호출해요: $value |> name(arguments).
필드
| 필드 | 타입 | 설명 |
|---|---|---|
.body | string | 원본 요청 본문이에요. |
.cookies | map | 클라이언트가 보낸 쿠키예요. |
.files | map | 입력 이름별로 업로드된 파일이에요. 각 항목은 { name, type, size, bytes } 목록이며, bytes는 base64예요: $request.files.avatar[0]. |
.form | map | 전송된 폼 필드예요. 예: $request.form.email. |
.headers | map | 소문자 이름을 가진 요청 헤더예요. |
.method | string | HTTP 메서드예요. 예: GET 또는 POST. |
.params | map | 요청 경로에서 캡처한 매개변수예요. |
.path | string | 경로예요. 예: /people. |
.query | map | 쿼리 문자열 값이에요. 예: $request.query.page. |
.route_info | map | 일치한 라우트 또는 파일 기반 페이지의 메타데이터예요. |
.scheme | string | 요청 스킴이에요. 예: http 또는 https. |
.url | string | 쿼리 문자열을 포함한 경로예요. 예: /people?page=2. |
any의 메서드
->convert(from?: 'json'|yaml|'csv'|'markdown'|'latex', to?: 'json'|yaml|'csv'|html|'markdown'|'latex', header?: bool, as?: type, headers?: list, indented?: bool)->from(type: 'json'|yaml|'csv'|'markdown'|'latex', header?: bool, as?: type)->is_a(type: word)->is_null()->or(fallback)->to(type: 'json'|yaml|'csv'|html|'markdown'|'latex', headers?: list, indented?: bool)->to_string()->type()