Source code a little bit more first look at the comments

Bridge from application code to network code. First, it builds a network request from the user. It then proceeds to call the network. Finally, it builds a user response response from the network.

Actually mainly build HTTP request header and processing response headers, HTTP response headers and request header information table: tools.jb51.net/table/http_…

Before proceeding, the request header is processed, including content-Type, Content-Length, Host, Connection, Accept-Encoding, Cookie, and user-Agent.

Process response. If transparentGzip = true, the compression type is GIZp, and the response is normal, then decompress. Remove content-encoding, content-Length, and leave the original content-Type passed to the next interceptor

The main purpose of this interceptor is to add some generic headers, such as Content-Type, Content-Length, and to process the Cookie information we configured in OkHttp as request headers. The accept-encoding header tells the server that it supports receiving a gZIP encoded stream. If the stream returned by the server is gZIP-compressed, the interceptor will decompress the stream. Finally, we reset the data flow to the body of the Response so that we can parse the data flow normally.

Refer to the blog

www.jianshu.com/p/fab2d74de…

The next article

To be determined