이 문서는 아직 자원 봉사자들이 한국어로 번역하지 않았습니다. 함께 해서 번역을 마치도록 도와 주세요!
The HTTP POST
method sends data to the server. The type of the body of the request is indicated by the Content-Type
header.
A POST
request is typically sent via an HTML form and results in a change on the server. In this case, the content type is selected by putting the adequate string in the enctype
attribute of the <form>
element or the formenctype
attribute of the <input>
or <button>
elements:
application/
x-www-form-urlencoded
: the values are encoded in key-value tuples separated by'&'
, with a'='
between the key and the value. Non-alphanumeric characters are percent encoded: this is the reason why this type is not suitable to use with binary data (useapplication/form-data
instead)application/form-data
text/plain
When the POST
request is sent via another method that an HTML form, like via an XMLHttpRequest
, the body can take any type. As described in the HTTP 1.1 specification, POST
is designed to allow a uniform method to cover the following functions:
- Annotation of existing resources
- Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles;
- Providing a block of data, such as the result of submitting a form, to a data-handling process;
- Extending a database through an append operation.
Request has body | Yes |
---|---|
Successful response has body | Yes |
Safe | No |
Idempotent | No |
Cacheable | Only if freshness information is included |
Allowed in HTML forms | Yes |
Syntax
POST /index.html
Example
A simple form using the default application/x-www-form-urlencoded
content type:
POST / HTTP/1.1 Host: foo.com Content-Type: application/x-www-form-urlencoded Content-Length: 13 say=Hi&to=Mom
A form using the multipart/form-data
content type:
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
Specifications
Specification | Title |
---|---|
RFC 7231, section 4.3.3: POST | Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content |
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | Servo |
---|---|---|---|---|---|---|---|
Basic Support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
Feature | Android | Chrome for Android | Edge Mobile | Firefox for Android | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic Support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |