request.py 566 B

12345678910111213141516171819202122
  1. from __future__ import annotations
  2. from dataclasses import dataclass, field
  3. from ..._base_connection import _TYPE_BODY
  4. @dataclass
  5. class EmscriptenRequest:
  6. method: str
  7. url: str
  8. params: dict[str, str] | None = None
  9. body: _TYPE_BODY | None = None
  10. headers: dict[str, str] = field(default_factory=dict)
  11. timeout: float = 0
  12. decode_content: bool = True
  13. def set_header(self, name: str, value: str) -> None:
  14. self.headers[name.capitalize()] = value
  15. def set_body(self, body: _TYPE_BODY | None) -> None:
  16. self.body = body