Skip to content

Implements Worker script upload methods - #74

Merged
SergkeiM merged 1 commit into
masterfrom
feature/worker-scripts-updated-content
Aug 14, 2026
Merged

SergkeiM merged 1 commit into
masterfrom
feature/worker-scripts-updated-content

Conversation

@SergkeiM

Copy link
Copy Markdown
Owner

Completes the implementation for uploading Worker scripts and their content across various endpoints:

  • Workers\Environment::update: Replaces the code of a Worker in a given environment, preserving existing settings and bindings.
  • Workers\Scripts::upload: Uploads a Worker, replacing its script and full configuration (bindings, compatibility date, etc.). This method expects a complete configuration to be sent.
  • Workers\Scripts::updateContent: Replaces only a Worker's code, leaving its configuration and metadata untouched.
  • Workers\Versions::upload: Now utilizes the shared helper for building multipart upload requests.

Introduces a new UploadsModules trait to centralize the logic for constructing multipart HTTP bodies required for uploading Worker modules and their associated metadata. This enhances code reusability, ensures consistent request formatting, and includes validation for module data.

Documentation, including usage examples and parameter tables, has been updated for all modified methods. New tests have been added to verify the correct functionality of these multipart upload operations. API coverage for the Workers resource has increased as a result of these additions.

Adds `upload` and `updateContent` methods to the Workers `Scripts` endpoint, and `update` to the `Environment` endpoint, while integrating the existing `Versions::upload` method.

Introduces a shared `UploadsModules` trait to handle Cloudflare's multipart upload format for Workers, which supports multiple modules and distinct metadata. This enables:
- Full script and configuration replacement (`scripts::upload`)
- Code-only updates, preserving configuration (`scripts::updateContent`, `environment::update`)
- Uploading new Worker versions (`versions::upload`)
@SergkeiM SergkeiM linked an issue Aug 14, 2026 that may be closed by this pull request
@SergkeiM
SergkeiM merged commit 273fcaa into master Aug 14, 2026
10 checks passed
@SergkeiM
SergkeiM deleted the feature/worker-scripts-updated-content branch August 14, 2026 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Worker Scripts - updated content

1 participant