class documentation

class TestResponse(Response):

View In Hierarchy

~werkzeug.wrappers.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.

Method __getitem__ Undocumented
Method __init__ Undocumented
Method __iter__ Undocumented
Class Variable __test__ Undocumented
Instance Variable history A list of intermediate responses. Populated when the test request is made with follow_redirects enabled.
Instance Variable request A request object with the environ used to make the request that resulted in this response.
Instance Variable ​_compat​_tuple Undocumented

Inherited from Response:

Class Method force​_type No summary
Class Method from​_app No summary
Method __call__ Process this response as WSGI application.
Method __enter__ Undocumented
Method __exit__ Undocumented
Method __repr__ Undocumented
Method add​_etag Add an etag for the current response if there is none yet.
Method calculate​_content​_length Returns the content length if available or None otherwise.
Method call​_on​_close No summary
Method close Close the wrapped response if possible. You can also use the object in a with statement which will automatically close it.
Method freeze Make the response object ready to be pickled. Does the following:
Method get​_app​_iter Returns the application iterator for the given environ. Depending on the request method and the current status code the return value might be an empty response rather than the one from the response.
Method get​_data The string representation of the response body. Whenever you call this property the response iterable is encoded and flattened. This can lead to unwanted behavior if you stream big data.
Method get​_json Parse data as JSON. Useful during testing.
Method get​_wsgi​_headers No summary
Method get​_wsgi​_response No summary
Method iter​_encoded No summary
Method make​_conditional No summary
Method make​_sequence No summary
Method set​_data Sets a new string as response. The value must be a string or bytes. If a string is set it's encoded to the charset of the response (utf-8 by default).
Class Variable autocorrect​_location​_header Undocumented
Class Variable automatically​_set​_content​_length Undocumented
Class Variable data Undocumented
Class Variable implicit​_sequence​_conversion Undocumented
Instance Variable content​_range Undocumented
Instance Variable direct​_passthrough Undocumented
Instance Variable response Undocumented
Instance Variable status​_code Undocumented
Property is​_sequence If the iterator is buffered, this property will be True. A response object will consider an iterator to be buffered if the response attribute is a list or tuple.
Property is​_streamed No summary
Property json The parsed JSON data if mimetype indicates JSON (:mimetype:`application/json`, see is_json).
Property stream The response iterable as write-only stream.
Method ​_ensure​_sequence This method can be called by methods that need a sequence. If mutable is true, it will also ensure that the response sequence is a standard Python list.
Method ​_is​_range​_request​_processable Return True if Range header is present and if underlying resource is considered unchanged when compared with If-Range header.
Method ​_process​_range​_request No summary
Method ​_wrap​_range​_response Wrap existing Response in case of Range Request context.
Instance Variable ​_on​_close Undocumented
def __getitem__(self, item):

Undocumented

Parameters
item:intUndocumented
Returns
t.AnyUndocumented
def __init__(self, response, status, headers, request, history=(), **kwargs):

Undocumented

Parameters
response:t.Iterable[bytes]Undocumented
status:strUndocumented
headers:HeadersUndocumented
request:RequestUndocumented
history:t.Tuple[TestResponse]Undocumented
**kwargs:t.AnyUndocumented
def __iter__(self):

Undocumented

Returns
t.IteratorUndocumented
__test__: bool =

Undocumented

history =
A list of intermediate responses. Populated when the test request is made with follow_redirects enabled.
request =
A request object with the environ used to make the request that resulted in this response.
_compat_tuple =

Undocumented