From 0053213d14c631c7586a924401b572848cd4cb2d Mon Sep 17 00:00:00 2001 From: AlexKamaev Date: Fri, 7 Apr 2023 12:58:38 +0400 Subject: [PATCH] publish the `injectUpload` method (#2872) --- src/index.ts | 2 ++ ts-defs/index.d.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/index.ts b/src/index.ts index 13c86b7af..fd0c527e7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,6 +3,7 @@ import Session from './session'; import ResponseMock from './request-pipeline/request-hooks/response-mock'; import RequestFilterRule from './request-pipeline/request-hooks/request-filter-rule'; import UploadStorage from './upload/storage'; +import { inject } from './upload/index'; import { processScript, isScriptProcessed } from './processing/script'; import ConfigureResponseEventOptions from './request-pipeline/request-hooks/events/configure-response-event-options'; import StateSnapshot from './session/state-snapshot'; @@ -57,6 +58,7 @@ export default { parseProxyUrl, sameOriginCheck, injectResources: PageProcessor.injectResources, + injectUpload: inject, INJECTABLE_SCRIPTS: SCRIPTS, acceptCrossOrigin, getAssetPath, diff --git a/ts-defs/index.d.ts b/ts-defs/index.d.ts index c6c1fd126..f2c084191 100644 --- a/ts-defs/index.d.ts +++ b/ts-defs/index.d.ts @@ -600,6 +600,9 @@ declare module 'testcafe-hammerhead' { /** Inject specified stuff to the page **/ export function injectResources (html: string, resources: PageInjectableResources, options?: PageRestoreStoragesOptions): string; + /** Prepare form post data **/ + export function injectUpload (contentTypeHeader: string|void, body: Buffer): Buffer | null; + /** Proxy injectable scripts **/ export const INJECTABLE_SCRIPTS: string[];