A resource that takes a callable with 5 parameters ``(method, url, params, headers, data)`` and returns ``(code, headers, body)``. The resource uses the callable to return a real response as a result of a request. The parameters for the callable are: - ``method``, the HTTP method as `bytes`. - ``url``, the full URL of the request as text. - ``params``, a dictionary of query parameters mapping query keys lists of values (sorted alphabetically). - ``headers``, a dictionary of headers mapping header keys to a list of header values (sorted alphabetically). - ``data``, the request body as `bytes`. The callable must return a ``tuple`` of (code, headers, body) where the code is the HTTP status code, the headers is a dictionary of bytes (unlike the `headers` parameter, which is a dictionary of lists), and body is a string that will be returned as the response body. If there is a stubbing error, the return value is undefined (if an exception is raised, :obj:`~twisted.web.resource.Resource` will just eat it and return 500 in its place). The callable, or whomever creates the callable, should have a way to handle error reporting.
Method | __init__ |
See :class:`StringStubbingResource`. |
Method | render |
Produce a response according to the stubs provided. |
Class Variable | is |
Undocumented |
Instance Variable | _get |
Undocumented |