| 1 | module http |
| 2 | |
| 3 | fn test_build_request_headers_with_empty_body_adds_content_length_zero() { |
| 4 | // Create a request with no data. |
| 5 | mut req := Request{} |
| 6 | // Build the headers for it. Ensure that Content-Length: 0 is added |
| 7 | // for requests without a body, which is required by some servers. |
| 8 | // We use a POST request, as it is most likely to be affected by this. |
| 9 | headers := req.build_request_headers(.post, 'localhost', 80, '/') |
| 10 | assert headers.contains('Content-Length: 0\r\n') |
| 11 | } |
| 12 |