dirisaHTTP
→ httpDo()E dira kopo ya HTTP.
dirisaHTTP(URL, [mokgwa], [mofuta], [faGoSiame], [faGoPalelwa])E busa Promise; dirisa letela mo tirong. URL e e tswang kwa ntle e letleletswe; CORS le melao ya HTTPS ya sebatli di a dira. Mofuta wa JSON ga o fetole maina a dinonofo tsa karabo. Dirisa Request go neela diteng le headers. Mofuta o ka nna json, text kgotsa blob.
Diparamethara
Karolo e e bidiwang “Diparamethara”| Leina | Mofuta | Tlhaloso |
|---|---|---|
URL | `mokwalo | Request` |
mokgwa (ka boitlhophelo) | mokwalo | GET, POST, PUT, PATCH kgotsa DELETE. |
mofuta (ka boitlhophelo) | mokwalo | json, text kgotsa blob. |
faGoSiame (ka boitlhophelo) | tiro | Tiro e e amogelang se se tlisitsweng. |
faGoPalelwa (ka boitlhophelo) | tiro | Tiro e e amogelang phoso. |
tiro setaLoeto() {
tlosaKanefase();
diri r = bopaKopoYaHTTP("data:text/plain,OK", "PUT", {"Content-Type": "text/plain"}, "Dumela");
diri d = letela dirisaHTTP(r, undefined, "text");
bopaTemana(d);
}