Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: instruct api to exclude script content on worker upload #1248

Merged
merged 1 commit into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/curvy-donuts-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"wrangler": patch
---

fix: instruct api to exclude script content on worker upload

When we upload a script bundle, we get the actual content of the script back in the response. Sometimes that script can be large (depending on whether the upload was large), and currently it may even be a badly escaped string. We can pass a queryparam `excludeScript` that, as it implies, exclude the script content in the response. This fix does that.

Fixes https://github.com/cloudflare/wrangler2/issues/1222
1 change: 1 addition & 0 deletions packages/wrangler/src/__tests__/publish.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5294,6 +5294,7 @@ function mockUploadWorkerRequest(
expect(envName).toEqual(env);
}
expect(queryParams.get("include_subdomain_availability")).toEqual("true");
expect(queryParams.get("excludeScript")).toEqual("true");
const formBody = body as FormData;
if (expectedEntry !== undefined) {
expect(await (formBody.get("index.js") as File).text()).toMatch(
Expand Down
7 changes: 6 additions & 1 deletion packages/wrangler/src/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,12 @@ export default async function publish(props: Props): Promise<void> {
method: "PUT",
body: createWorkerUploadForm(worker),
},
new URLSearchParams({ include_subdomain_availability: "true" })
new URLSearchParams({
include_subdomain_availability: "true",
// pass excludeScript so the whole body of the
// script doesn't get included in the response
excludeScript: "true",
})
)
).available_on_subdomain;
}
Expand Down