Adding headers with json_response methode

I have a REST response method returns like below. Here i need to add a header in the response. How can I add this ?

match_count = len(matches)
headers = {‘Total’: match_count}
return web.json_response({“matches”: fdata})

According to the documentation, you can add headers argument to customize response headers.

Earlier, I sorted out this. Issue here with my headers Dict was, the match_count variable was an Int. You need to convert this to a String to be correct. Solutions here.

return web.json_response({"matches: fadata}, headers={"Total": str(len(matches))}