Initial code

This commit is contained in:
Kevin Alberts 2025-07-15 13:46:48 +02:00
parent f628266c2a
commit 3519df4299
5 changed files with 114 additions and 0 deletions

25
http_test_server.py Normal file
View file

@ -0,0 +1,25 @@
from http.server import BaseHTTPRequestHandler, HTTPServer
import os
PORT = int(os.getenv("PORT", "8000"))
class handler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-type','text/html')
self.end_headers()
message = "Hello, World! Here is a GET response"
self.wfile.write(bytes(message, "utf8"))
def do_POST(self):
self.send_response(200)
self.send_header('Content-type','application/json')
self.end_headers()
message = "{\"hello\": \"response\"}"
self.wfile.write(bytes(message, "utf8"))
with HTTPServer(('', PORT), handler) as server:
server.serve_forever()