ClickHouse/tests/integration/test_s3_cluster/s3_mocks/s3_mock.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
545 B
Python
Raw Normal View History

2023-05-04 07:56:00 +00:00
import sys
2024-09-27 10:19:39 +00:00
from bottle import request, response, route, run
2023-05-04 07:56:00 +00:00
@route("/<_bucket>/<_path:path>")
def server(_bucket, _path):
result = (
request.headers["MyCustomHeader"]
if "MyCustomHeader" in request.headers
else "unknown"
)
response.content_type = "text/plain"
response.set_header("Content-Length", len(result))
return result
@route("/")
def ping():
response.content_type = "text/plain"
response.set_header("Content-Length", 2)
return "OK"
run(host="0.0.0.0", port=int(sys.argv[1]))