Returns a decoder instance which can be used to decode the raw byte content, depending on the Content-Encoding used in the response.
(self)
| 697 | return _parse_content_type_charset(content_type) |
| 698 | |
| 699 | def _get_content_decoder(self) -> ContentDecoder: |
| 700 | """ |
| 701 | Returns a decoder instance which can be used to decode the raw byte |
| 702 | content, depending on the Content-Encoding used in the response. |
| 703 | """ |
| 704 | if not hasattr(self, "_decoder"): |
| 705 | decoders: list[ContentDecoder] = [] |
| 706 | values = self.headers.get_list("content-encoding", split_commas=True) |
| 707 | for value in values: |
| 708 | value = value.strip().lower() |
| 709 | try: |
| 710 | decoder_cls = SUPPORTED_DECODERS[value] |
| 711 | decoders.append(decoder_cls()) |
| 712 | except KeyError: |
| 713 | continue |
| 714 | |
| 715 | if len(decoders) == 1: |
| 716 | self._decoder = decoders[0] |
| 717 | elif len(decoders) > 1: |
| 718 | self._decoder = MultiDecoder(children=decoders) |
| 719 | else: |
| 720 | self._decoder = IdentityDecoder() |
| 721 | |
| 722 | return self._decoder |
| 723 | |
| 724 | @property |
| 725 | def is_informational(self) -> bool: |
no test coverage detected