You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 5-network/01-fetch-basics/article.md
+20-19Lines changed: 20 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,71 +45,72 @@ if (response.ok) { // if HTTP-status is 200-299
45
45
46
46
Response gövdesini (body) almak için, ek bir yöntem çağrısı yapmamız gerekiyor.
47
47
48
-
`Response` provides multiple promise-based methods to access the body in various formats:
48
+
`Response` gövdesine erişmek için birden fazla format ve özellik vardır:
49
+
50
+
-**`response.json()`** -- yanıtı JSON nesnesi olarak ayrıştırır,
51
+
-**`response.text()`** -- yanıtı metin (text) olarak döndürür,
52
+
-**`response.formData()`** -- yanıtı FormData nesnesi olarak döndürür (form/çok parçalı kodlama),
53
+
-**`response.blob()`** -- yanıtı Blob türünde döndürür [Blob](info:blob) (binary data tipi (ikili)),
54
+
-**`response.arrayBuffer()`** -- yanıtı [ArrayBuffer](info:arraybuffer-binary-arrays) türünde döndürür (saf ikili veri),
55
+
- ek olarak, `response.body` bir, [ReadableStream](https://streams.spec.whatwg.org/#rs-class) nesnesidir, gövdeyi parça parça okumaya izin verir, daha sonra bir örnek göreceğiz.
49
56
50
-
-**`response.json()`** -- parse the response as JSON object,
51
-
-**`response.text()`** -- return the response as text,
52
-
-**`response.formData()`** -- return the response as FormData object (form/multipart encoding),
53
-
-**`response.blob()`** -- return the response as [Blob](info:blob) (binary data with type),
54
-
-**`response.arrayBuffer()`** -- return the response as [ArrayBuffer](info:arraybuffer-binary-arrays) (pure binary data),
55
-
- additionally, `response.body` is a [ReadableStream](https://streams.spec.whatwg.org/#rs-class) object, it allows to read the body chunk-by-chunk, we'll see an example later.
56
57
57
-
For instance, here we get a JSON-object with latest commits from GitHub:
58
+
Örneğin, burada GitHub'dan en son commitleri içeren bir JSON nesnesi alıyoruz:
58
59
59
60
```js run async
60
61
let response =awaitfetch('https://api.github.com/repos/javascript-tutorial/en.javascript.info/commits');
61
62
62
63
*!*
63
-
let commits =awaitresponse.json(); //read response body and parse as JSON
64
+
let commits =awaitresponse.json(); //yanıt gövdesini okuyun ve JSON olarak ayrıştırın
64
65
*/!*
65
66
66
67
alert(commits[0].author.login);
67
68
```
68
69
69
-
Or, the same using pure promises syntax:
70
+
Ya da promises sözdizimi kullanarak aynısını yapabilirsiniz:
0 commit comments