mirror of
https://github.com/xtr-dev/payload-automation.git
synced 2025-12-10 08:53:23 +00:00
15 lines
356 B
TypeScript
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
|
|
}
|
|
}
|