blob: a67f4a7c87fd671c5a67eb971132343730404af6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
---
title: PATCH
slug: Web/HTTP/Methods/PATCH
translation_of: Web/HTTP/Methods/PATCH
---
<div>{{HTTPSidebar}}</div>
<p><strong>HTTP PATCH</strong> 메소드는 리소스의 부분적인 수정을 할 때에 사용됩니다.</p>
<p>HTTP {{HTTPMethod("PUT")}} 메소드는 문서 전체의 완전한 교체만을 허용합니다. 반면 <code>PATCH</code> 메소드는 <code>PUT</code> 메소드와 달리 멱등성을 가지지 않는데, 이는 동일한 patch 요청이 다른 결과를 야기할 수도 있음을 뜻합니다. 하지만 PATCH를 PUT과 같은 방식으로 사용함으로써 멱등성을 가지게 할 수도 있습니다.</p>
<p><code>PATCH</code> (혹은 <code>PUT</code>)는 다른 리소스에게 부수효과(side-effects)를 일으킬 가능성이 있습니다.</p>
<p>서버가 <code>PATCH</code>를 지원하는지 알 수 있게끔 하기 위해, 서버는 {{HTTPHeader("Allow")}} 리스트 혹은 {{HTTPHeader("Access-Control-Allow-Methods")}} (for CORS) 응답 헤더를 통해 이를 명시할 수 있습니다.</p>
<p>PATCH가 허용되는지 확인할 수 있는 또 다른 (암묵적인)지표로 {{HTTPHeader("Accept-Patch")}}의 존재 유무를 들 수 있는데, 이를 통해 patch 문서 양식이 서버에 받아 들여졌음을 알 수 있습니다.</p>
<table class="properties">
<tbody>
<tr>
<th scope="row">Request has body</th>
<td>Yes</td>
</tr>
<tr>
<th scope="row">Successful response has body</th>
<td>Yes</td>
</tr>
<tr>
<th scope="row">{{Glossary("Safe")}}</th>
<td>No</td>
</tr>
<tr>
<th scope="row">{{Glossary("Idempotent")}}</th>
<td>No</td>
</tr>
<tr>
<th scope="row">{{Glossary("Cacheable")}}</th>
<td>No</td>
</tr>
<tr>
<th scope="row">Allowed in <a href="/en-US/docs/Web/Guide/HTML/Forms">HTML forms</a></th>
<td>No</td>
</tr>
</tbody>
</table>
<h2 id="Syntax">Syntax</h2>
<pre class="syntaxbox notranslate">PATCH /file.txt HTTP/1.1
</pre>
<h2 id="Example">Example</h2>
<h3 id="Request">Request</h3>
<pre class="line-numbers language-html notranslate">PATCH /file.txt HTTP/1.1
Host: www.example.com
Content-Type: application/example
If-Match: "e0023aa4e"
Content-Length: 100
[description of changes]</pre>
<h3 id="Response">Response</h3>
<p>성공적인 응답은 2xx 상태 코드를 통해서 확인할 수 있습니다.</p>
<p>아래의 예시에서는 {{HTTPStatus("204")}} 응답이 사용되었는데, 이는 응답이 유의미한 body를 전달하고 있지 않기 때문입니다. {HTTPStatus("200")}} 응답에서는 body에 유의미한 데이터가 포함되어 있음을 유추할 수 있습니다.</p>
<pre class="newpage notranslate">HTTP/1.1 204 No Content
Content-Location: /file.txt
ETag: "e0023aa4f"</pre>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Title</th>
</tr>
<tr>
<td>{{RFC("5789", "PATCH")}}</td>
<td>PATCH Method for HTTP</td>
</tr>
</tbody>
</table>
<h2 id="See_also">See also</h2>
<ul>
<li>{{HTTPStatus("204")}}</li>
<li>{{HTTPHeader("Allow")}}, {{HTTPHeader("Access-Control-Allow-Methods")}}</li>
<li>{{HTTPHeader("Accept-Patch")}} – specifies the patch document formats accepted by the server.</li>
</ul>
|