INNER CODE UNIT · Python

do_POST

Arthur-Ficial/apfel · mcp/http-test-server/server.py:196

        def do_POST(self):
            if self.path != path:
                self.send_response(404)
                self.end_headers()
                return
            if token:
                auth = self.headers.get("Authorization", "")
                if auth != f"Bearer {token}":
                    self.send_response(401)
                    self.send_header("Content-Type", "application/json")
                    self.end_headers()
                    self.wfile.write(b'{"error":"unauthorized"}')
                    return
            length = int(self.headers.get("Content-Length", 0))
            raw = self.rfile.read(length)
            try:
                body = json.loads(raw)
            except json.JSONDecodeError:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…