Files
payload-automation/src/steps/http-request-handler.ts
2025-08-29 18:11:36 +02:00

15 lines
356 B
TypeScript

import type {TaskHandler} from "payload"
export const httpStepHandler: TaskHandler<'http-request-step'> = async ({input}) => {
if (!input) {
throw new Error('No input provided')
}
const response = await fetch(input.url)
return {
output: {
response: await response.text()
},
state: response.ok ? 'succeeded' : undefined
}
}