Skip to content

Commit c89fe81

Browse files
committed
docs: network/01-fetch 충돌 해결
1 parent 71ab899 commit c89fe81

1 file changed

Lines changed: 0 additions & 36 deletions

File tree

5-network/01-fetch/article.md

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ let promise = fetch(url, [options])
2727
- **`url`** -- 접근하고자 하는 URL
2828
- **`options`** -- 선택 매개변수, method나 header 등을 지정할 수 있음
2929

30-
<<<<<<< HEAD
3130
`options`에 아무것도 넘기지 않으면 요청은 `GET` 메서드로 진행되어 `url`로부터 콘텐츠가 다운로드 됩니다.
32-
=======
33-
Without `options`, this is a simple GET request, downloading the contents of the `url`.
34-
>>>>>>> upstream/master
3531

3632
`fetch()`를 호출하면 브라우저는 네트워크 요청을 보내고 프라미스가 반환됩니다. 반환되는 프라미스는 `fetch()`를 호출하는 코드에서 사용됩니다.
3733

@@ -65,21 +61,12 @@ if (response.ok) { // HTTP 상태 코드가 200~299일 경우
6561

6662
`response` 에는 프라미스를 기반으로 하는 다양한 메서드가 있습니다. 이 메서드들을 사용하면 다양한 형태의 응답 본문을 처리할 수 있습니다.
6763

68-
<<<<<<< HEAD
6964
- **`response.text()`** -- 응답을 읽고 텍스트를 반환합니다,
7065
- **`response.json()`** -- 응답을 JSON 형태로 파싱합니다,
7166
- **`response.formData()`** -- 응답을 `FormData` 객체 형태로 반환합니다. `FormData`에 대한 자세한 내용은 [다음 챕터](info:formdata)에서 다루겠습니다.
7267
- **`response.blob()`** -- 응답을 [Blob](info:blob)(타입이 있는 바이너리 데이터) 형태로 반환합니다.
7368
- **`response.arrayBuffer()`** -- 응답을 [ArrayBuffer](info:arraybuffer-binary-arrays)(바이너리 데이터를 로우 레벨 형식으로 표현한 것) 형태로 반환합니다.
7469
- 이 외에도 `response.body`가 있는데, [ReadableStream](https://streams.spec.whatwg.org/#rs-class) 객체인 `response.body`를 사용하면 응답 본문을 청크 단위로 읽을 수 있습니다. 자세한 용례는 곧 살펴보겠습니다.
75-
=======
76-
- **`response.text()`** -- read the response and return as text,
77-
- **`response.json()`** -- parse the response as JSON,
78-
- **`response.formData()`** -- return the response as `FormData` object (explained in the [next chapter](info:formdata)),
79-
- **`response.blob()`** -- return the response as [Blob](info:blob) (binary data with type),
80-
- **`response.arrayBuffer()`** -- return the response as [ArrayBuffer](info:arraybuffer-binary-arrays) (low-level representation of binary data),
81-
- additionally, `response.body` is a [ReadableStream](https://streams.spec.whatwg.org/#rs-class) object, it allows you to read the body chunk-by-chunk, we'll see an example later.
82-
>>>>>>> upstream/master
8370

8471
지금까지 배운 내용을 토대로 GitHub에서 마지막 커밋을 JSON 객체 형태로 받아봅시다.
8572

@@ -205,21 +192,12 @@ let response = fetch(protectedUrl, {
205192

206193
`GET` 이외의 요청을 보내려면 추가 옵션을 사용해야 합니다.
207194

208-
<<<<<<< HEAD
209195
- **`method`** -- HTTP 메서드(예: `POST`)
210196
- **`body`** -- 요청 본문으로 다음 항목 중 하나이어야 합니다.
211197
- 문자열(예: JSON 문자열)
212198
- `FormData`객체 -- `form/multipart` 형태로 데이터를 전송하기 위해 쓰입니다.
213199
- `Blob``BufferSource` -- 바이너리 데이터 전송을 위해 쓰입니다.
214200
- [URLSearchParams](info:url) -- 데이터를 `x-www-form-urlencoded` 형태로 보내기 위해 쓰이는데, 요즘엔 잘 사용하지 않습니다.
215-
=======
216-
- **`method`** -- HTTP-method, e.g. `POST`,
217-
- **`body`** -- the request body, one of:
218-
- a string (e.g. JSON-encoded),
219-
- `FormData` object, to submit the data as `multipart/form-data`,
220-
- `Blob`/`BufferSource` to send binary data,
221-
- [URLSearchParams](info:url), to submit the data in `x-www-form-urlencoded` encoding, rarely used.
222-
>>>>>>> upstream/master
223201

224202
대부분은 JSON을 요청 본문에 실어 보내게 됩니다.
225203

@@ -318,7 +296,6 @@ fetch(url, options)
318296
.then(result => /* 결과 처리 */)
319297
```
320298

321-
<<<<<<< HEAD
322299
응답 객체의 프로퍼티는 다음과 같습니다.
323300
- `response.status` -- 응답의 HTTP 코드
324301
- `response.ok` -- 응답 상태가 200과 299 사이에 있는 경우 `true`
@@ -330,19 +307,6 @@ fetch(url, options)
330307
- **`response.formData()`** -- 응답을 `FormData` 객체 형태로 반환(form/multipart 인코딩에 대한 내용은 다음 챕터에서 다룸)
331308
- **`response.blob()`** -- 응답을 [Blob](info:blob)(타입이 있는 바이너리 데이터) 형태로 반환
332309
- **`response.arrayBuffer()`** -- 응답을 [ArrayBuffer](info:arraybuffer-binary-arrays)(바이너리 데이터를 로우 레벨로 표현한 것) 형태로 반환
333-
=======
334-
Response properties:
335-
- `response.status` -- HTTP code of the response,
336-
- `response.ok` -- `true` if the status is 200-299.
337-
- `response.headers` -- Map-like object with HTTP headers.
338-
339-
Methods to get response body:
340-
- **`response.text()`** -- return the response as text,
341-
- **`response.json()`** -- parse the response as JSON object,
342-
- **`response.formData()`** -- return the response as `FormData` object (`multipart/form-data` encoding, see the next chapter),
343-
- **`response.blob()`** -- return the response as [Blob](info:blob) (binary data with type),
344-
- **`response.arrayBuffer()`** -- return the response as [ArrayBuffer](info:arraybuffer-binary-arrays) (low-level binary data),
345-
>>>>>>> upstream/master
346310

347311
지금까지 배운 `fetch` 옵션은 다음과 같습니다.
348312
- `method` -- HTTP 메서드

0 commit comments

Comments
 (0)