|
} |
|
r.Header().Set("Content-Type", "application/force-download") |
|
r.Header().Set("Accept-Ranges", "bytes") |
|
r.Header().Set("Content-Disposition", fmt.Sprintf(`attachment;filename=%s`, url.QueryEscape(downloadName))) |
|
r.Server.serveFile(r.Request, serveFile) |
|
} |
As mentioned in axios/axios#895 and https://stackoverflow.com/questions/43912862/axios-expose-response-headers-content-disposition , the server side has to enable CORS-related feature for axios request to read Content-Disposition header, so the file can be downloaded with the given filename.