Encodes body with the given encoding, where e is "gzip", "deflate", "identity", "br", or "zstd". Any existing content-encodings are overwritten, the content is not decoded beforehand. *Raises:* - `ValueError`, when the specified content-encoding is invalid.
(self, encoding: str)
| 481 | self.content = decoded |
| 482 | |
| 483 | def encode(self, encoding: str) -> None: |
| 484 | """ |
| 485 | Encodes body with the given encoding, where e is "gzip", "deflate", "identity", "br", or "zstd". |
| 486 | Any existing content-encodings are overwritten, the content is not decoded beforehand. |
| 487 | |
| 488 | *Raises:* |
| 489 | - `ValueError`, when the specified content-encoding is invalid. |
| 490 | """ |
| 491 | self.headers["content-encoding"] = encoding |
| 492 | self.content = self.raw_content |
| 493 | if "content-encoding" not in self.headers: |
| 494 | raise ValueError(f"Invalid content encoding {encoding!r}") |
| 495 | |
| 496 | def json(self, **kwargs: Any) -> Any: |
| 497 | """ |
no outgoing calls
no test coverage detected