add cookies support for front import

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-11-10 18:39:32 +01:00
parent ec5646504a
commit 15281ad833
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0

View File

@ -192,10 +192,19 @@ export function start (transactorEndpoint: string, elasticUrl: string, minio: Cl
const token = authHeader.split(' ')[1]
const payload = decode(token ?? '', 'secret', false) as Token
const url = req.query.url as string
const cookie = req.query.cookie as string | undefined
console.log('importing from ', url)
https.get(url, response => {
const options = cookie !== undefined
? {
headers: {
Cookie: cookie
}
}
: {}
https.get(url, options, response => {
console.log('status', response.statusCode)
const id = uuid()
const contentType = response.headers['content-type']