Skip to content

Commit

Permalink
workers: default body to provided payload
Browse files Browse the repository at this point in the history
This was previously incorrectly always using `body` (an uninitialised
slice of bytes) for the script payload when the configuration was not
for an ES module upload. Fixes the upload so that both types are
covered.
  • Loading branch information
jacobbednarz committed Dec 23, 2022
1 parent f7fa179 commit 7e65cb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/1155.txt
@@ -0,0 +1,3 @@
```release-note:bug
workers: correctly set `body` value for non-ES module uploads
```
2 changes: 1 addition & 1 deletion workers.go
Expand Up @@ -214,10 +214,10 @@ func (api *API) UploadWorker(ctx context.Context, rc *ResourceContainer, params
return WorkerScriptResponse{}, ErrMissingAccountID
}

body := []byte(params.Script)
var (
contentType = "application/javascript"
err error
body []byte
)

if params.Module || len(params.Bindings) > 0 {
Expand Down

0 comments on commit 7e65cb2

Please sign in to comment.