test_routes_server_response
Tests for routes server response framing behavior.
Classes
RoutesServerWriteResponseTests
Bases: TestCase
Functions
test_sets_content_length_for_large_json_payload()
Source code in pyrevitlib/pyrevit/unittests/test_routes_server_response.py
test_encodes_string_body_as_utf8_bytes()
Source code in pyrevitlib/pyrevit/unittests/test_routes_server_response.py
test_writes_newline_when_body_is_none()
Source code in pyrevitlib/pyrevit/unittests/test_routes_server_response.py
test_calls_end_headers_without_custom_headers()
Source code in pyrevitlib/pyrevit/unittests/test_routes_server_response.py
test_overrides_existing_content_length_header()
Source code in pyrevitlib/pyrevit/unittests/test_routes_server_response.py
RoutesServerQueryParsingTests
Bases: TestCase
Tests for the query-string parsing logic in _prepare_request.
Functions
test_single_value_key_flattened_to_string()
A query param with one value should be stored as a plain string.
Source code in pyrevitlib/pyrevit/unittests/test_routes_server_response.py
test_multiple_distinct_keys_parsed_independently()
Each distinct key in the query string is stored as its own entry.
Source code in pyrevitlib/pyrevit/unittests/test_routes_server_response.py
test_empty_query_string_produces_empty_dict()
An absent query string leaves query_params empty.
test_none_query_string_produces_empty_dict()
A None query string leaves query_params empty.
test_repeated_key_stored_as_list()
A key that appears more than once should be stored as a list.
Source code in pyrevitlib/pyrevit/unittests/test_routes_server_response.py
test_repeated_key_list_preserves_all_values()
All values for a repeated key must be present — none are dropped.
Source code in pyrevitlib/pyrevit/unittests/test_routes_server_response.py
test_mixed_single_and_multi_value_keys()
Single-value and multi-value keys can coexist in the same query.
Source code in pyrevitlib/pyrevit/unittests/test_routes_server_response.py
test_url_encoded_value_is_decoded()
URL percent-encoding in query values must be decoded.
Source code in pyrevitlib/pyrevit/unittests/test_routes_server_response.py
test_url_encoded_special_characters()
Percent-encoded characters in query values are decoded properly.
Source code in pyrevitlib/pyrevit/unittests/test_routes_server_response.py
test_query_params_do_not_affect_request_path()
Query string parameters must not bleed into the request path.
Source code in pyrevitlib/pyrevit/unittests/test_routes_server_response.py
test_query_params_do_not_affect_route_params()
Query parameters are stored separately from URL path parameters.
Source code in pyrevitlib/pyrevit/unittests/test_routes_server_response.py
RoutesServerHandlerKwargsTests
Bases: TestCase
Tests that query_params are injected into handler kwargs correctly.
Functions
test_single_query_param_injected_as_kwarg()
A single-value query param is passed to the handler as a kwarg.
Source code in pyrevitlib/pyrevit/unittests/test_routes_server_response.py
test_multi_value_query_param_injected_as_list()
A repeated query param is passed to the handler as a list kwarg.
Source code in pyrevitlib/pyrevit/unittests/test_routes_server_response.py
test_query_param_not_in_handler_signature_is_excluded()
Query params that don't match handler parameters are filtered out.
Source code in pyrevitlib/pyrevit/unittests/test_routes_server_response.py
test_request_object_always_injected()
The request object is always present in handler kwargs.
Source code in pyrevitlib/pyrevit/unittests/test_routes_server_response.py
test_query_params_and_route_params_coexist_in_kwargs()
Route path params and query params are both present in kwargs.