gws.test.util.http

Web requests.

ref: https://werkzeug.palletsprojects.com/en/3.0.x/test/

Source code: gws.test.util.http

Module Contents

gws.test.util.http.api(root, cmd, request=None, **kwargs) TestResponse
gws.test.util.http.get(root, url, **kwargs) TestResponse
gws.test.util.http.post(root, url, **kwargs) TestResponse
class gws.test.util.http.TestResponse(response: Iterable[bytes], status: str, headers: werkzeug.datastructures.Headers, request: werkzeug.wrappers.request.Request, history: tuple[TestResponse] = (), **kwargs: Any)

Response subclass that provides extra information about requests made with the test Client.

Test client requests will always return an instance of this class. If a custom response class is passed to the client, it is subclassed along with this to support test information.

If the test request included large files, or if the application is serving a file, call close() to close any open files and prevent Python showing a ResourceWarning.

Changed in version 2.2: Set the default_mimetype to None to prevent a mimetype being assumed if missing.

Changed in version 2.1: Response instances cannot be treated as tuples.

Added in version 2.0: Test client methods always return instances of this class.

cookies: dict[str, werkzeug.test.Cookie]