FastAPI - Authentication and Security
Given this FastAPI code snippet, what will be the response if the client sends a request without the 'X-API-Key' header?
from fastapi import FastAPI, Security, HTTPException
from fastapi.security import APIKeyHeader
app = FastAPI()
api_key_header = APIKeyHeader(name='X-API-Key')
@app.get('/secure')
async def secure_endpoint(api_key: str = Security(api_key_header)):
if api_key != 'secret123':
raise HTTPException(status_code=403, detail='Invalid API Key')
return {'message': 'Access granted'}