处理设置到body上的数据默认 headers

def handel_default(self) -> None:
        """
        处理设置到body上的数据默认 headers
        """
        raw_body = self._body
        body = cast(Optional[bytes], None)
        default_type = 2
        charset = self._charset or self._default_charset
        if raw_body is None:
            pass
        elif isinstance(raw_body, bytes):
            # body为bytes
            default_type = 2
            body = raw_body
        elif isinstance(raw_body, str):
            # body 为字符串
            default_type = 2
            body = encode_str(raw_body, charset)
        elif isinstance(raw_body, (list, dict)):
            # body 为json
            default_type = 3
            body = encode_str(json.dumps(raw_body, ensure_ascii=False), charset)
        elif isinstance(raw_body, RawIOBase):
            # body 为文件
            default_type = 1
            body = raw_body.read()
            raw_body.close()
        if "Content-Length" not in self._headers and \
                "Transfer-Encoding" not in self._headers \
                or self._headers["Transfer-Encoding"] != "chunked":
            if self.length is None:
                if body is not None:
                    self.length = len(body)
                else:
                    self.length = 0
            # 设置默认 Content-Length
            self.set("Content-Length", str(self.length))
        # print(body[0], body[1])
        if body is not None and body.startswith(encode_str("<", charset)):
            default_type = 4
        if "Content-Type" not in self._headers.keys():
            type_str = self.type
            if type_str is None:
                temp = DEFAULT_TYPE.get(default_type)
                if temp is not None:
                    if default_type != 1:
                        temp += "; charset=%s" % charset
                    type_str = temp
            if type_str is not None:
                # 设置默认 Content-Type
                self.set("Content-Type", type_str)
        self._body = body