MCPcopy Create free account
hub / github.com/TGX-Android/Publisher / postHuaweiForm

Function postHuaweiForm

main.js:1599–1619  ·  view source on GitHub ↗
(url, form, needBinary)

Source from the content-addressed store, hash-verified

1597}
1598
1599function postHuaweiForm (url, form, needBinary) {
1600 return new Promise((accept, reject) => {
1601 const parsed = new URL(url);
1602 const protocol = (parsed.protocol === 'https:' ? https : http);
1603 const options = {
1604 host: parsed.host,
1605 path: parsed.pathname + parsed.search,
1606 method: 'POST',
1607 headers: Object.assign(form.getHeaders(), {
1608 'accept': 'application/json',
1609 'User-Agent': 'Telegram-X-Publisher'
1610 })
1611 };
1612 const req = protocol.request(options, (res) => {
1613 toUtf8(res, (contentType, content) => {
1614 accept({statusCode: res.statusCode, statusMessage: res.statusMessage, content, contentType});
1615 }, needBinary);
1616 }).on('error', reject);
1617 form.pipe(req);
1618 });
1619}
1620
1621async function uploadHuaweiApk (build, targetFiles, accessToken, uploadUrl, authCode) {
1622 const apkFilePath = targetFiles.apkFile.path;

Callers 1

uploadHuaweiApkFunction · 0.85

Calls 1

toUtf8Function · 0.85

Tested by

no test coverage detected