UNPKG

@percy/core

Version:

The core component of Percy's CLI and SDKs that handles creating builds, discovering snapshot assets, uploading snapshots, and finalizing builds. Uses `@percy/client` for API communication, a Chromium browser for asset discovery, and starts a local API se

16 lines (13 loc) 624 B
export async function request(url, method = 'GET', handle) { if (typeof method === 'boolean' || typeof method === 'function') [handle, method] = [method, 'GET']; let cb = typeof handle === 'boolean' ? (handle ? (...a) => a : (_, r) => r) : handle; let options = typeof method === 'string' ? { method } : method; let { request } = await import('@percy/client/utils'); try { return await request(url, options, cb); } catch (error) { if (!error.response || typeof handle !== 'boolean') throw error; return handle ? [error.response.body, error.response] : error.response; } } export default request;