Two, HTTP request

First, the test object: v2ex of api

Documentation: https: www.v2ex.com/p/7vpTEc53

api:https://www.v2ex.com/api/topic/hot.json

The hottest topic: the equivalent of the contents of each of the 10 on the right side of the home page

Method:GET

Authentication:None

Two, http request

Is the HTTP message exchange of data between server and client

There are two types of messages

  • Request - by the client operation starting on a server for transmitting
  • Response - a response from the server

Reference: https: //developer.mozilla.org/zh-CN/docs/Web/HTTP/Messages

Third, constitute http request

1, the start line (line containing starting components 3) POST / HTTP / 1.1

  • An HTTP method, a verb (as GET, PUT or POST) or a noun (like the OPTIONS or HEAD), describe the action to be performed
  • Request destination (request target), typically a URL, protocol or an absolute path, and the domain name of the port, to request the environment generally characterized
  • HTTP version (HTTP Version), defines the structure of the remaining messages, as desired influence indicator version

2、Headers

  • HTTP headers from the request follows the same header and HTTP basic structure: a case-insensitive string, followed by a colon (:) and a value dependent on the structure of the header. The entire header (including the value) by a single line, the line can be quite long

3、Body

  • The last part of the request is its body
  • Not all requests have a body: for example, access to resources request, GET, HEAD, DELETE and OPTIONS, usually they do not need body
  • Some requests to the server to send data to the update data: often the case that a POST request (containing HTML form data)

 

 

Guess you like

Origin www.cnblogs.com/xinxin1994/p/11258488.html