728x90
반응형
HTTP Request Method (HTTP 요청 방법)
HTTP 는 GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, PATCH Reqeust Method 가 있으며,
상황별 알맞게 사용을 권장한다.
GET
The GET method requests a representation of the specified resource. Requests using GET should only retrieve data and should have no other effect. (This is also true of some other HTTP methods.)[1] The W3C has published guidance principles on this distinction, saying, "Web application design should be informed by the above principles, but also by the relevant limitations."
- 서버로부터 적절한 자료를 요청할 때 사용
- 오직 자료를 받을때만 사용되며 서버에서 어느 작용도 되어서는 안 됨
(예를 들어 Database 에서 SELECT 역할을 수행)
HEAD
The HEAD method asks for a response identical to that of a GET request, but without the response body. This is useful for retrieving meta-information written in response headers, without having to transport the entire content.
- GET 요청 시에 받아올 헤더와 같은 메타 데이터를 받을 수 있음
- Response body 는 받아오지 않음
POST
The POST method requests that the server accept the entity enclosed in the request as a new subordinate of the web resource identified by the URI. The data POSTed might be, for example, an annotation for existing resources; a message for a bulletin board, newsgroup, mailing list, or comment thread; a block of data that is the result of submitting a web form to a data-handling process; or an item to add to a database.
- 데이터 생성 혹은 수정으로 사용
PUT
The PUT method requests that the enclosed entity be stored under the supplied URI. If the URI refers to an already existing resource, it is modified; if the URI does not point to an existing resource, then the server can create the resource with that URI.
- 데이터 생성 혹은 수정으로 사용
- 만약 데이터가 없다면, 생성
- 만약 데이터가 있다면, 수정
POST 와 PUT 의 다른점
The difference between POST and PUT is that PUT requests are idempotent. That is, calling the same PUT request multiple times will always produce the same result. In contrast, calling a POST request repeatedly have side effects of creating the same resource multiple times.
PUT으로 상호작용 하는 데이터는 항상 대상이 같아야 하며, POST는 계속해서 같은 데이터를 생성할 수 있다.
DELETE
The DELETE method deletes the specified resource.
- 특정 데이터 삭제시 사용
CONNECT
The CONNECT method converts the request connection to a transparent TCP/IP tunnel, usually to facilitate SSL-encrypted communication (HTTPS) through an unencrypted HTTP proxy.[30][31] See HTTP CONNECT method.
- Client 와 Server 가 SSL handshake 시, Client 가 Proxy 에게 Server 와 TCP Connection 에서 사용
OPTIONS
The OPTIONS method returns the HTTP methods that the server supports for the specified URL. This can be used to check the functionality of a web server by requesting '*' instead of a specific resource.
- 특정 URL에서 사용할 수 있는 Method 들을 확인에 사용
TRACE
The TRACE method echoes the received request so that a client can see what (if any) changes or additions have been made by intermediate servers.
- Server 로부터 받은 데이터를 Client 가 확실히 적용 여부를 위해 반복 확인에 사용
PATCH
The PATCH method applies partial modifications to a resource.
- 데이터의 부분 수정에 사용
728x90
반응형
'IT > Web' 카테고리의 다른 글
DNS(Domain Name System) 작동원리 (0) | 2021.01.15 |
---|---|
브라우저 동작 원리 (0) | 2021.01.15 |
HTTP Response Status Code (HTTP 응답 상태 코드) (0) | 2021.01.14 |
HTTP (HyperText Transfer Protocol) 란? (0) | 2021.01.13 |
2020년 백엔드(Back-end) 개발자 로드맵 (0) | 2021.01.13 |