export type GetApiOTHEREximOtherSendHarRequestOptions = {baseUrl?: string | undefined, apiKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Sends the first HAR request entry, optionally following redirections. Returns, in HAR format, the request sent and response received and followed redirections, if any. The Mode is enforced when sending the request (and following redirections), custom manual requests are not allowed in 'Safe' mode nor in 'Protected' mode if out of scope. * * GET /OTHER/exim/other/sendHarRequest/ * * Also accepts auth: apiKeyQuery */ export const getApiOTHEREximOtherSendHarRequest = async (options?: GetApiOTHEREximOtherSendHarRequestOptions) => { const {baseUrl = "http://zap", fetch: fetchFn = fetch, apiKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (apiKeyHeader !== undefined) headers.set("X-ZAP-API-Key", apiKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/OTHER/exim/other/sendHarRequest/${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };