headerOptions[namespace + 'Signature'] = signature var headers = new fetch.Headers() for(var i in headerOptions) { headers.set(i, headerOptions[i])
async function github(req) { try { const url = req.params && req.params.url.replace(/https:/,'').replace(/\/\//,'') || req.replace(/https:/,'').replace(/\/\//,'') // console.log(`https://${url}`); const response = await fetch(`https://${url}`, process.env.KEY_GITHUB && {headers: new fetch.Headers({Authorization:`token ${process.env.KEY_GITHUB}`})}) if (response.status >= 300) return new Error(`${response.status} ${url}`) const b64 = await response.json() const buff = await Buffer.from(b64.content, 'base64') return await buff.toString('utf8') } catch(err) { return err } }
app.get('/figma/update', (req, res) => { let headers = new fetch.Headers(); let componentList = []; let devToken = process.env.DEV_TOKEN;