UNPKG

@sap_oss/wdio-qmate-service

Version:

[![REUSE status](https://api.reuse.software/badge/github.com/SAP/wdio-qmate-service)](https://api.reuse.software/info/github.com/SAP/wdio-qmate-service)[![Node.js CI](https://github.com/SAP/wdio-qmate-service/actions/workflows/node.js.yml/badge.svg)](http

34 lines 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createUsage = createUsage; const undici_1 = require("undici"); const constants_1 = require("./constants"); async function createUsage(usageData) { const urlUsage = `${constants_1.STATS_SERVER_URL}/api/usage/qmate`; try { const response = await (0, undici_1.fetch)(urlUsage, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(usageData), dispatcher: new undici_1.Agent({ connect: { rejectUnauthorized: false, } }) }); if (!response.ok) { return null; } else { const responseText = await response.text(); const responseData = JSON.parse(responseText); return responseData.id; } } catch (error) { return null; } } //# sourceMappingURL=createUsage.js.map