@@ -232,9 +232,11 @@ func newAdminServer(ctx *dbosContext, port int) *adminServer {
232232 ctx .logger .Debug ("Registering admin server endpoint" , "pattern" , _WORKFLOWS_PATTERN )
233233 mux .HandleFunc (_WORKFLOWS_PATTERN , func (w http.ResponseWriter , r * http.Request ) {
234234 var req listWorkflowsRequest
235- if err := json .NewDecoder (r .Body ).Decode (& req ); err != nil {
236- http .Error (w , fmt .Sprintf ("Invalid JSON input: %v" , err ), http .StatusBadRequest )
237- return
235+ if r .ContentLength > 0 {
236+ if err := json .NewDecoder (r .Body ).Decode (& req ); err != nil {
237+ http .Error (w , fmt .Sprintf ("Invalid JSON input: %v" , err ), http .StatusBadRequest )
238+ return
239+ }
238240 }
239241
240242 workflows , err := ctx .ListWorkflows (req .toListWorkflowsOptions ()... )
@@ -254,9 +256,11 @@ func newAdminServer(ctx *dbosContext, port int) *adminServer {
254256 ctx .logger .Debug ("Registering admin server endpoint" , "pattern" , _QUEUED_WORKFLOWS_PATTERN )
255257 mux .HandleFunc (_QUEUED_WORKFLOWS_PATTERN , func (w http.ResponseWriter , r * http.Request ) {
256258 var req listWorkflowsRequest
257- if err := json .NewDecoder (r .Body ).Decode (& req ); err != nil {
258- http .Error (w , fmt .Sprintf ("Invalid JSON input: %v" , err ), http .StatusBadRequest )
259- return
259+ if r .ContentLength > 0 {
260+ if err := json .NewDecoder (r .Body ).Decode (& req ); err != nil {
261+ http .Error (w , fmt .Sprintf ("Invalid JSON input: %v" , err ), http .StatusBadRequest )
262+ return
263+ }
260264 }
261265
262266 workflows , err := ctx .ListWorkflows (req .toListWorkflowsOptions ()... )
0 commit comments