Baseline Widely available *
Fetch APIì Request
ì¸í°íì´ì¤ë 리ìì¤ ìì²ì ëíë
ëë¤.
ìë¡ì´ Request
ê°ì²´ë Request()
ìì±ìë¡ë ìì±í ì ìì§ë§, ë³´íµì ìë¹ì¤ ì커ì FetchEvent.request
ì²ë¼ ë¤ë¥¸ API ìì
ì ê²°ê³¼ë¡ì ë§ëê² ë©ëë¤.
Request()
ìë¡ì´ Request
ê°ì²´ë¥¼ ìì±í©ëë¤.
Request.body
ì½ê¸° ì ì©
본문 ë´ì©ì ReadableStream
ì
ëë¤.
Request.bodyUsed
ì½ê¸° ì ì©
ìì²ì ë³¸ë¬¸ì´ ì¬ì©ëëì§ ìëì§ ëíë´ë true
ëë false
ì
ëë¤.
Request.cache
ì½ê¸° ì ì©
ìì²ì ìºì 모ë(default
, reload
, no-cache
ë±)ì
ëë¤.
Request.credentials
ì½ê¸° ì ì©
ìì²ì ì격 ì¦ëª
(omit
, same-origin
, include
ë±)ì
ëë¤. 기본 ê°ì same-origin
ì
ëë¤.
Request.destination
ì½ê¸° ì ì©
ìì²ì 목ì ì§ë¥¼ ë¬ì¬íë 문ìì´ì ë°íí©ëë¤. ìì²í ì½í ì¸ ì ì íì ëíë´ë 문ìì´ì ëë¤.
ìì²ì ì°ê´ë Headers
ê°ì²´ì
ëë¤.
Request.integrity
ì½ê¸° ì ì©
ìì²ì íì 리ìì¤ ë¬´ê²°ì± ê°(ìì: sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=
)ì
ëë¤.
Request.method
ì½ê¸° ì ì©
ìì²ì ë©ìë(GET
, POST
ë±)ì
ëë¤.
Request.mode
ì½ê¸° ì ì©
ìì²ì 모ë(cors
, no-cors
, same-origin
, navigate
ë±)ì
ëë¤.
Request.redirect
ì½ê¸° ì ì©
리ë¤ì´ë í¸ ì²ë¦¬ ë°©ë²ì
ëë¤. follow
, error
, manual
ì¤ íëì
ëë¤.
Request.referrer
ì½ê¸° ì ì©
ìì²ì 리í¼ë¬(ìì: client
)ì
ëë¤.
Request.referrerPolicy
ì½ê¸° ì ì©
ìì²ì 리í¼ë¬ ì ì±
(no-referrer
ë±)ì
ëë¤.
Request.signal
ì½ê¸° ì ì©
ìì²ì ì°ê´ë AbortSignal
ì ë°íí©ëë¤.
Request.url
ì½ê¸° ì ì©
ìì² URLì ëë¤.
Request.arrayBuffer()
ìì² ë³¸ë¬¸ì ArrayBuffer
ííì¼ë¡ ì´ííë íë¡ë¯¸ì¤ë¥¼ ë°íí©ëë¤.
Request.blob()
ìì² ë³¸ë¬¸ì Blob
ííì¼ë¡ ì´ííë íë¡ë¯¸ì¤ë¥¼ ë°íí©ëë¤.
Request.clone()
Request
ê°ì²´ì ë³µì¬ë³¸ì ìì±í©ëë¤.
Request.formData()
ìì² ë³¸ë¬¸ì FormData
ííì¼ë¡ ì´ííë íë¡ë¯¸ì¤ë¥¼ ë°íí©ëë¤.
Request.json()
ìì² ë³¸ë¬¸ì JSON
ì¼ë¡ íì±í ê²°ê³¼ë¡ ì´ííë íë¡ë¯¸ì¤ë¥¼ ë°íí©ëë¤.
Request.text()
ìì² ë³¸ë¬¸ì text ííì¼ë¡ ì´ííë íë¡ë¯¸ì¤ë¥¼ ë°íí©ëë¤.
ì°¸ê³ : ìì² ë³¸ë¬¸ í¨ìë ì¤ì§ í ë²ë§ ì¤íí ì ììµëë¤. ì´íì í¸ì¶ì ë¹ ë¬¸ìì´ í¹ì ë¹ ArrayBuffer
ë¡ ì´íí ê²ì
ëë¤.
ë¤ì ì½ë ì¡°ê°ììë Request()
ìì±ìë¡ ì¤í¬ë¦½í¸ì ê°ì ëë í 리ì ìì¹íë ì´ë¯¸ì§ íì¼ì ëí ìë¡ì´ ìì²ì ìì±íê³ , í´ë¹ ìì²ì ëªëª ìì±ì ë°íí©ëë¤.
const request = new Request("https://www.mozilla.org/favicon.ico");
const url = request.url;
const method = request.method;
const credentials = request.credentials;
ê·¸ ë¤ìì fetch()
í¸ì¶ì 매ê°ë³ìì ì´ Request
ê°ì²´ë¥¼ ì ê³µíì¬ ì´ë¯¸ì§ë¥¼ ì·¨ëí ì ììµëë¤.
fetch(request)
.then((response) => response.blob())
.then((blob) => {
image.src = URL.createObjectURL(blob);
});
ë¤ì ì½ë ì¡°ê°ììë Request()
ìì±ì를 í¸ì¶í ë, 본문ì ë°ë¼ë APIì ëí ìì²ì ìí´ ì¼ë¶ ì¤ì ê³¼ 본문 ë°ì´í°ë¥¼ ì ê³µí©ëë¤.
const request = new Request("https://example.com", {
method: "POST",
body: '{"foo": "bar"}',
});
const url = request.url;
const method = request.method;
const credentials = request.credentials;
const bodyUsed = request.bodyUsed;
ì°¸ê³ : 본문ì íëì Blob
, ArrayBuffer
, TypedArray
, DataView
, FormData
, URLSearchParams
, ReadableStream
, String
ê°ì²´, 문ìì´ ë¦¬í°ë´ ë±ë§ ê°ë¥íë¯ë¡ JSON ê°ì²´ë¥¼ 본문ì¼ë¡ ë³´ë´ë ¤ë©´ 먼ì 문ìì´íí´ì¼ í©ëë¤.
ê·¸ ë¤ìì fetch()
í¸ì¶ì 매ê°ë³ìì ì´ Request
ê°ì²´ë¥¼ ì ê³µíì¬ ìëµì ë°ì ì ììµëë¤.
fetch(request)
.then((response) => {
if (response.status === 200) {
return response.json();
} else {
throw new Error("API ìë²ìì ëê° ì못ëìµëë¤!");
}
})
.then((response) => {
console.debug(response);
// â¦
})
.catch((error) => {
console.error(error);
});
ëª
ì¸ì ë¸ë¼ì°ì í¸íì± ê°ì´ 보기
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4