I'm trying to set the name of the header in the model description, but it remains empty in the documentation. What am I doing wrong?
Example:
@router.get('/hash_header',response_model=models.hash_out,tags=["use-hash"],responses={
200: {
"model": models.hash_out,
"description": "Return has code",
"headers": [
{'name':"Secret-Code","description":"Secret code","type":"string"}
]
}
})
CodePudding user response:
headers
should be a dictionary with the name as a key, not a list:
@router.get('/hash_header',response_model=models.hash_out,tags=["use-hash"],responses={
200: {
"model": models.hash_out,
"description": "Return has code",
"headers": {
"Secret-Code": {"description":"Secret code","type":"string"}
}
}
})