ZEPETO.Multiplay.HttpService
11 분
형식 설명 httpcontenttype /#httpcontenttype http content type을 지정하는 상수의 열거형입니다 httpbodytype /#httpbodytype http 본문 내용의 타입 별칭이며, 일반 텍스트 또는 키 값 객체를 사용할 수 있습니다 httpheader /#httpheader http 헤더의 타입 별칭이며, 키 값 객체를 나타냅니다 httperrortype /#httperrortype http 요청 실패 원인을 지정하는 상수의 열거형입니다 httperror /#httperror http 요청 중 발생한 오류를 나타냅니다 httpresponse /#httpresponse http 응답을 나타냅니다 httpservice /#httpservice httpservice 는 외부 웹 서비스와 http 연결을 맺고 요청을 보내기 위한 api를 제공합니다 https 프로토콜을 사용해야 합니다 http는 개발 환경에서만 지원됩니다 요청은 80번과 443번 포트로 제한됩니다 요청 본문과 응답 본문의 최대 크기는 16kb입니다 요청이 과도할 경우 world 서비스에 제한이 걸릴 수 있으므로, 분당 요청 수를 500회 미만으로 유지하세요 외부 웹 서비스가 5초 이내에 응답하지 않으면 요청이 실패합니다 요청 실패를 방지하려면 응답 헤더의 content type이 httpcontenttype 열거형에 정의된 값과 일치하는지 확인하세요 웹 요청은 여러 원인으로 실패할 수 있으므로 방어적으로 코드를 작성하는 것을 권장합니다 httpcontenttype enum http content type을 지정하는 상수의 열거형입니다 이름 값 설명 applicationjson "application/json" application/json 콘텐츠 타입을 나타냅니다 applicationxml "application/xml" application/xml 콘텐츠 타입을 나타냅니다 applicationurlencoded "application/x www form urlencoded" application/x www form urlencoded 콘텐츠 타입을 나타냅니다 textplain "text/plain" text/plain 콘텐츠 타입을 나타냅니다 textxml "text/xml" text/xml 콘텐츠 타입을 나타냅니다 httpbodytype delegate http 본문 내용의 타입 별칭이며, 일반 텍스트 또는 키 값 객체를 사용할 수 있습니다 string | { \[key string] any; } httpheader delegate http 헤더의 타입 별칭이며, 키 값 객체를 나타냅니다 { \[key string] string | number; } httperrortype enum http 요청 실패 원인을 지정하는 상수의 열거형입니다 이름 값 설명 err access denied "err access denied" 오류 접근이 거부되었습니다 err length required "err length required" 오류 길이 지정이 필요합니다 httperror interface · extends error http 요청 중 발생한 오류를 나타냅니다 속성 이름 형식 설명 message string 오류 메시지입니다 code string httperrortype 열거형의 값으로 정의된 오류 코드입니다 httpresponse interface http 응답을 나타냅니다 속성 이름 형식 설명 statuscode number 응답의 상태 코드입니다 일반적으로 200은 요청 성공을 의미합니다 statustext string 상태 코드에 대응하는 상태 메시지입니다 일반적으로 "ok"는 요청 성공을 의미합니다 response string http 응답의 본문입니다 응답의 content type에 따라 형식이 달라질 수 있습니다 수신한 content type에 맞는 적절한 파서를 사용하는 것을 권장합니다 httpservice interface httpservice 는 외부 웹 서비스와 http 연결을 맺고 요청을 보내기 위한 api를 제공합니다 https 프로토콜을 사용해야 합니다 http는 개발 환경에서만 지원됩니다 요청은 80번과 443번 포트로 제한됩니다 요청 본문과 응답 본문의 최대 크기는 16kb입니다 요청이 과도할 경우 world 서비스에 제한이 걸릴 수 있으므로, 분당 요청 수를 500회 미만으로 유지하세요 외부 웹 서비스가 5초 이내에 응답하지 않으면 요청이 실패합니다 요청 실패를 방지하려면 응답 헤더의 content type이 httpcontenttype 열거형에 정의된 값과 일치하는지 확인하세요 웹 요청은 여러 원인으로 실패할 수 있으므로 방어적으로 코드를 작성하는 것을 권장합니다 메서드 getasync getasync(url string, headers? httpheader) → promise\<httpresponse> http get 요청을 비동기로 수행합니다 httperror 를 발생시킵니다 매개변수 형식 설명 url string 요청을 보낼 웹 주소입니다 headers (선택 사항) httpheader /#httpheader http 요청 헤더입니다 (선택 사항) 반환값 promise\<httpresponse> — 작업 완료 시 httpresponse 객체와 함께 이행되는 promise 입니다 postasync postasync(url string, body httpbodytype, headers? httpheader) → promise\<httpresponse> http post 요청을 비동기로 수행합니다 httperror 를 발생시킵니다 매개변수 형식 설명 url string 요청을 보낼 웹 주소입니다 body httpbodytype /#httpbodytype 요청 본문 내용입니다 headers (선택 사항) httpheader /#httpheader http 요청 헤더입니다 (선택 사항) 반환값 promise\<httpresponse> — 작업 완료 시 httpresponse 객체와 함께 이행되는 promise 입니다 postasync postasync(url string, body httpbodytype, httpcontenttype httpcontenttype, headers? httpheader) → promise\<httpresponse> http post 요청을 비동기로 수행합니다 httperror 를 발생시킵니다 이 시그니처를 사용할 때 headers에 'content type'을 추가하면, httpcontenttype 에 지정한 값으로 덮어써집니다 매개변수 형식 설명 url string 요청을 보낼 웹 주소입니다 body httpbodytype /#httpbodytype 요청 본문 내용입니다 httpcontenttype httpcontenttype /#httpcontenttype 요청의 content type 헤더를 지정합니다 headers (선택 사항) httpheader /#httpheader http 요청 헤더입니다 (선택 사항) 반환값 promise\<httpresponse> — 작업 완료 시 httpresponse 객체와 함께 이행되는 promise 입니다