1 import type { WebRequest } from 'webextension-polyfill';
4 * When intercepting xmlhttprequests, only
5 * start tracking requests which "smell" like
6 * a form submission : presence of formData in
7 * the body without any errors.
9 export const requestHasBodyFormData = ({ requestBody }: WebRequest.OnBeforeRequestDetailsType): boolean =>
10 Boolean(requestBody && !requestBody.error && (requestBody.formData || requestBody.raw));
12 export const isFailedRequest = ({ statusCode }: WebRequest.OnCompletedDetailsType): boolean =>
13 statusCode < 600 && statusCode >= 400;