import urllib.request
import urllib.error

# Test /health first
for url in [
    "http://127.0.0.1:5000/health",
    "http://127.0.0.1:5000/api/v1/auth/me",
    "http://127.0.0.1:5000/api/v1/memos",
]:
    req = urllib.request.Request(url, headers={"Authorization": "Bearer invalid"})
    try:
        with urllib.request.urlopen(req) as resp:
            print(f"[{resp.status}] GET {url}: {resp.read().decode()[:100]}")
    except urllib.error.HTTPError as e:
        body = e.read().decode()[:200]
        print(f"[{e.code}] GET {url}: {body}")
    except Exception as e:
        print(f"[ERR] GET {url}: {e}")
