def wrapped_app(req):
resp = app(req)
if not resp or resp.get("headers", {}).get("content_type"):
return resp
mime_type, _ = mimetypes.guess_type(req["uri"])
return response.with_content_type(resp,
mime_type or "application/octet-stream")
return wrapped_app