Skip to content

Commit

Permalink
Merge pull request #1345 from slester/fix-dispatch-api
Browse files Browse the repository at this point in the history
Fix dispatch API path
  • Loading branch information
jacobbednarz authored Aug 1, 2023
2 parents bea1d62 + 362c1d7 commit 0a82ee6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/1345.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
workers: Fix namespace dispatch upload API path
```
2 changes: 1 addition & 1 deletion workers.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func (api *API) UploadWorker(ctx context.Context, rc *ResourceContainer, params

uri := fmt.Sprintf("/accounts/%s/workers/scripts/%s", rc.Identifier, params.ScriptName)
if params.DispatchNamespaceName != nil {
uri = fmt.Sprintf("/accounts/%s/workers/namespaces/%s/scripts/%s", rc.Identifier, *params.DispatchNamespaceName, params.ScriptName)
uri = fmt.Sprintf("/accounts/%s/workers/dispatch/namespaces/%s/scripts/%s", rc.Identifier, *params.DispatchNamespaceName, params.ScriptName)
}

headers := make(http.Header)
Expand Down
2 changes: 1 addition & 1 deletion workers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ func TestUploadWorker_ToDispatchNamespace(t *testing.T) {
fmt.Fprint(w, workersScriptResponse(t))
}
mux.HandleFunc(
fmt.Sprintf("/accounts/"+testAccountID+"/workers/namespaces/%s/scripts/bar", namespaceName),
fmt.Sprintf("/accounts/"+testAccountID+"/workers/dispatch/namespaces/%s/scripts/bar", namespaceName),
handler,
)

Expand Down

0 comments on commit 0a82ee6

Please sign in to comment.