class TestResponse(Response):
~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 |
Undocumented
Parameters | |
response:t.Iterable[ | Undocumented |
status:str | Undocumented |
headers:Headers | Undocumented |
request:Request | Undocumented |
history:t.Tuple[ | Undocumented |
**kwargs:t.Any | Undocumented |