Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

Using input param in callTask() instead of depricated body and contentType

Marek Trunkate099cd8f1982
diff --git a/src/actor.js b/src/actor.js
index dd04b7630..6cac569d3 100644
--- a/src/actor.js
+++ b/src/actor.js
@@ -497,7 +497,7 @@ export const callTask = async (taskId, input, options = {}) => {
if (build) runTaskOpts.build = build;
if (memoryMbytes) runTaskOpts.memory = memoryMbytes;
if (timeoutSecs >= 0) runTaskOpts.timeout = timeoutSecs; // Zero is valid value!
- if (input) addInputOptionsOrThrow(input, options.contentType, runTaskOpts);
+ if (input) runTaskOpts.input = input;
// Start task.
const { waitSecs } = options;
diff --git a/test/actor.js b/test/actor.js
index adfc758b1..88a564c63 100644
--- a/test/actor.js
+++ b/test/actor.js
@@ -717,8 +717,7 @@ describe('Apify.callTask()', () => {
.withExactArgs({
token,
taskId,
- body: JSON.stringify(input, null, 2),
- contentType: 'application/json; charset=utf-8',
+ input,
memory: memoryMbytes,
timeout: timeoutSecs,
build,