Add User-Agent header (#2602)

This commit is contained in:
MeiMei
2018-09-04 17:44:21 +09:00
committed by syuilo
parent 921609cab1
commit 5b039a1bee
5 changed files with 12 additions and 2 deletions

View File

@@ -34,7 +34,12 @@ export default async (url: string, user: IUser, folderId: mongodb.ObjectID = nul
// write content at URL to temp file
await new Promise((res, rej) => {
const writable = fs.createWriteStream(path);
request(url)
request({
url,
headers: {
'User-Agent': config.user_agent
}
})
.on('error', rej)
.on('end', () => {
writable.close();