HTTP

이지은·2021년 3월 22일
0

1. HTTP

(Hypertext Transfer Protocol) is an applicaion-layer protocol for transmitting hypermedia documents such as HTML.

  • communication between web browsers and web servers
    : request and response
  • classical client-server model (client make a request, then waiting until it receives a response)
  • HTTP is a stateless protocol (no data between two requests)

2. HTTP Headers

  • used to describe a resource or the behavior of the server/client.

3. HTTP Request Methods

1) GET: Requests using Get only retrieve data.
2) POST: used to submit an entity to the specified resource
3) DELETE: deletes the specified resource
4) PATCH: apply partial modifications to a resource

etc...

  1) Start Line: 
   
   HTTP Method/ Reuest target/ HTTP Version
   ex) POST/login HTTP/l.1
   
  Headers: (additional info:meta data)
  
 2) Host-> target adress
 
  User-Agent-> client info
  Content-Type-> body type
  Content-Length-> body length
  Authorization-> ex)login token
  
  3) Body: 
  ex) Body: {
  "user_password":'jenna8447"
  }

ex)

fetch("http://10.58.2.116:8003/product", {
      method: "POST",
      headers: {
        Authorization: localStorage.getItem("access_token"),
      },
      body: formData,
    })

4. HTTP Status Responses Codes

1) 200: OK
2) 201: Created
3) 400: Bad Request
4) 401: Unauthorized
5) 403: Forbidden
6) 404: Not Found
7) 500: Internal Server Error

profile
Front-end 🐕🦶

0개의 댓글