use hyphen for query parameter

This commit is contained in:
Kristian Krsnik 2024-04-11 23:18:51 +02:00
parent 8f2a575010
commit 9ef9c8454b
Signed by: Kristian
GPG Key ID: FD1330AC9F909E85

View File

@ -4,7 +4,7 @@ import argparse
import json
from os.path import exists
from fastapi import FastAPI, Request, HTTPException
from fastapi import FastAPI, Request, HTTPException, Query
from fastapi.responses import StreamingResponse
from fastapi import status
from hypercorn.config import Config
@ -44,7 +44,7 @@ class MinSizePerRequestError(Exception):
@api.get('/')
def test_data(api_key: str, size: str, request: Request) -> StreamingResponse:
def test_data(request: Request, size: str, api_key: str = Query(..., alias="api-key")) -> StreamingResponse:
try:
if api_key not in AUTHORIZED_KEYS:
raise HTTPException(