--- title: POST slug: Web/HTTP/Methods/POST tags: - HTTP - Reference - Request method translation_of: Web/HTTP/Methods/POST --- <div>{{HTTPSidebar}}</div> <p><strong>HTTP <code>POST</code> 메서드</strong>는 서버로 데이터를 전송합니다. 요청 본문의 유형은 {{httpheader("Content-Type")}} 헤더로 나타냅니다.</p> <p>{{httpmethod("PUT")}}과 <code>POST</code>의 차이는 {{glossary("idempotent", "멱등성")}}으로, <code>PUT</code>은 멱등성을 가집니다. <code>PUT</code>은 한 번을 보내도, 여러 번을 연속으로 보내도 같은 효과를 보입니다. 즉, 부수 효과(side effect)가 없습니다.</p> <p><code>POST</code> 요청은 보통 <a href="/ko/docs/Learn/HTML/Forms">HTML 양식</a>을 통해 서버에 전송하며, 서버에 변경사항을 만듭니다. 이 경우의 콘텐츠 유형(<code>Content-Type</code>)은 <dfn> {{HTMLElement("form")}} 요소의 {{htmlattrxref("enctype", "form")}} 특성이나 {{HTMLElement("input") }}, {{HTMLElement("button")}} </dfn>요소의 <dfn>{{htmlattrxref("formenctype", "input")}} 특성 안에 적당한 문자열을 넣어 결정합니다.</dfn></p> <ul> <li><code>application/</code><dfn><code>x-www-form-urlencoded</code>: &으로 분리되고, "=" 기호로 값과 키를 연결하는 key-value tuple로 인코딩되는 값입니다.</dfn><dfn> 영어 알파벳이 아닌 문자들은 {{glossary("percent encoded")}} 으로 인코딩됩니다. 따라서, 이 content type은 바이너리 데이터에 사용하기에는 적절치 않습니다. (바이너리 데이터에는 use <code>multipart/form-data</code> 를 사용해 주세요.)</dfn></li> <li><dfn><code>multipart/form-data</code></dfn></li> <li><dfn><code>text/plain</code></dfn></li> </ul> <p><code>POST</code> 요청을 HTML 양식 외의 다른 방법({{domxref("XMLHttpRequest")}} 등)으로 전송할 땐 요청의 본문이 어떤 형태도 취할 수 있습니다. HTTP 1.1 규격에 정의된 바와 같이, <code>POST</code>는 다음의 기능을 포함하는 균일한 메서드를 허용하도록 설계되었습니다.</p> <ul> <li>기존 리소스에 주석달기</li> <li>게시판, 뉴스 그룹, 메일링 리스트나 이와 유사한 시스템에 글 올리기</li> <li>회원가입 모달로 새로운 사용자 추가하기</li> <li>양식 전송 결과 등 데이터 블록을 데이터 처리 프로세스에 보내기</li> <li>이어붙이기 연산을 통한 데이터베이스 확장</li> </ul> <table class="properties"> <tbody> <tr> <th scope="row">요청에 본문 존재</th> <td>예</td> </tr> <tr> <th scope="row">성공 응답에 본문 존재</th> <td>예</td> </tr> <tr> <th scope="row">{{Glossary("Safe", "안전함")}}</th> <td>아니오</td> </tr> <tr> <th scope="row">{{Glossary("Idempotent", "멱등성")}}</th> <td>아니오</td> </tr> <tr> <th scope="row">{{Glossary("Cacheable", "캐시 가능")}}</th> <td>신선도 정보 포함 시</td> </tr> <tr> <th scope="row">HTML 양식에서 사용 가능</th> <td>예</td> </tr> </tbody> </table> <h2 id="구문">구문</h2> <pre class="syntaxbox">POST /index.html </pre> <h2 id="예제">예제</h2> <p>다음은 <code>application/x-www-form-urlencoded</code> 콘텐츠 유형을 사용하는 간단한 형태의 양식 제출 예시입니다.</p> <pre class="line-numbers language-html">POST / HTTP/1.1 Host: foo.com Content-Type: application/x-www-form-urlencoded Content-Length: 13 say=Hi&to=Mom</pre> <p><code>multipart/form-data</code> 콘텐츠 유형을 사용하는 예시입니다.</p> <pre>POST /test.html HTTP/1.1 Host: example.org Content-Type: multipart/form-data;boundary="boundary" --boundary Content-Disposition: form-data; name="field1" value1 --boundary Content-Disposition: form-data; name="field2"; filename="example.txt" value2 --boundary-- </pre> <h2 id="명세">명세</h2> <table class="standard-table"> <tbody> <tr> <th scope="col">Specification</th> <th scope="col">Title</th> </tr> <tr> <td>{{RFC("7231", "POST", "4.3.3")}}</td> <td>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</td> </tr> <tr> <td>{{RFC("2046", "Common Syntax", "5.1.1")}}</td> <td>Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types</td> </tr> </tbody> </table> <h2 id="브라우저_호환성">브라우저 호환성</h2> <p>{{Compat("http.methods.POST")}}</p> <h2 id="같이_보기">같이 보기</h2> <ul> <li>{{HTTPHeader("Content-Type")}}</li> <li>{{HTTPHeader("Content-Disposition")}}</li> <li>{{httpmethod("GET")}}</li> </ul>