This API is supposed to download the raw javascript.
https://api.cloudflare.com/#worker-script-download-worker
Old workers I created awhile ago, look fine with curl --request GET https://api.cloudflare.com/client/v4/accounts/:account_identifier/workers/scripts/:script_name
.
I.e. the fetched text is just the entire javascript.
But newly created workers are getting polluted with some multipart stuff at the top and bottom:
--8330eaed1ff1fe9ac747b6ab8d5efa7f60aa1b801efce31fc7d0d44957de
Content-Disposition: form-data; name="worker.js"
export default {
async fetch(request, env) {
return await handleRequest(request)
}
}
async function handleRequest(request) {
return new Response("Hello world")
}
--8330eaed1ff1fe9ac747b6ab8d5efa7f60aa1b801efce31fc7d0d44957de--