Test large request bodies getting rejected without a crash. Run over plain HTTP: with TLS, a client that sends the whole body before reading the response can only see a connection reset instead of the 413, depending on the OpenSSL version.
(node_factory)
| 887 | |
| 888 | |
| 889 | def test_large_request_body(node_factory): |
| 890 | """Test large request bodies getting rejected without a crash. |
| 891 | |
| 892 | Run over plain HTTP: with TLS, a client that sends the whole body before |
| 893 | reading the response can only see a connection reset instead of the 413, |
| 894 | depending on the OpenSSL version. |
| 895 | """ |
| 896 | l1, base_url, _ = start_node_with_clnrest(node_factory, protocol='http') |
| 897 | http_session = http_session_with_retry() |
| 898 | |
| 899 | body = b'{"pad":"' + b"B" * (32 * 1024 * 1024) + b'"}' |
| 900 | response = http_session.post(base_url + "/v1/getinfo", data=body) |
| 901 | assert response.status_code == 413 |
| 902 | assert response.json()["code"] == -32600 |
| 903 | assert "Request body exceeds the maximum allowed size" in response.json()["message"] |
| 904 | |
| 905 | l1.rpc.getinfo() |
nothing calls this directly
no test coverage detected