mirror of
https://github.com/m1ngsama/TUT.git
synced 2025-12-26 12:04:11 +00:00
Add full support for POST method form submissions alongside existing GET support. Changes: - Add HttpClient::post() method with configurable Content-Type - Implement URL encoding for form data (RFC 3986 compliant) - Update Browser::submit_form() to detect and handle both GET and POST methods - Add proper form data encoding with special character handling - Include Content-Type header for POST requests Features: - Automatic method detection from form's method attribute - URL-encoded form data (application/x-www-form-urlencoded) - Proper encoding of special characters (spaces, &, =, etc.) - Status messages for form submission feedback - History tracking for POST responses Testing: - Add test_post_form.html with GET, POST, and special character test cases - Uses httpbin.org endpoints for validation Resolves TODO at browser.cpp:238 - POST handling is now fully implemented.
31 lines
1.1 KiB
HTML
31 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>POST Form Test</title>
|
|
</head>
|
|
<body>
|
|
<h1>Form Method Test</h1>
|
|
|
|
<h2>GET Form</h2>
|
|
<form action="https://httpbin.org/get" method="get">
|
|
<p>Name: <input type="text" name="name" value="John"></p>
|
|
<p>Email: <input type="text" name="email" value="john@example.com"></p>
|
|
<p><input type="submit" value="Submit GET"></p>
|
|
</form>
|
|
|
|
<h2>POST Form</h2>
|
|
<form action="https://httpbin.org/post" method="post">
|
|
<p>Username: <input type="text" name="username" value="testuser"></p>
|
|
<p>Password: <input type="password" name="password" value="secret123"></p>
|
|
<p>Message: <input type="text" name="message" value="Hello World"></p>
|
|
<p><input type="submit" value="Submit POST"></p>
|
|
</form>
|
|
|
|
<h2>Form with Special Characters</h2>
|
|
<form action="https://httpbin.org/post" method="post">
|
|
<p>Text: <input type="text" name="text" value="Hello & goodbye!"></p>
|
|
<p>Code: <input type="text" name="code" value="a=b&c=d"></p>
|
|
<p><input type="submit" value="Submit"></p>
|
|
</form>
|
|
</body>
|
|
</html>
|