Skip to content
This repository has been archived by the owner on Dec 16, 2020. It is now read-only.

Commit

Permalink
Update status code for CRUD operations
Browse files Browse the repository at this point in the history
This commit updates the status code from 200 to 202 for create, update
or delete APIs.

Fixes: #25

Signed-off-by: Vivek Singh <[email protected]>
  • Loading branch information
viveksyngh authored and alexellis committed Sep 28, 2018
1 parent 1bcf4a5 commit 7dc0494
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion handlers/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func DeleteHandler(c *client.Client) http.HandlerFunc {
log.Println(serviceRemoveErrors)
w.WriteHeader(http.StatusInternalServerError)
} else {
w.WriteHeader(http.StatusOK)
w.WriteHeader(http.StatusAccepted)
}

}
Expand Down
4 changes: 3 additions & 1 deletion handlers/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ func DeployHandler(c *client.Client, maxRestarts uint64, restartDelay time.Durat
if len(response.Warnings) > 0 {
log.Println(response.Warnings)
}

w.WriteHeader(http.StatusAccepted)
}
}

Expand Down Expand Up @@ -362,7 +364,7 @@ func buildLabels(request *requests.CreateFunctionRequest) (map[string]string, er
}

if request.Annotations != nil {
for k,v := range *request.Annotations {
for k, v := range *request.Annotations {
key := fmt.Sprintf("%s%s", annotationLabelPrefix, k)
if _, ok := labels[key]; !ok {
labels[key] = v
Expand Down
1 change: 1 addition & 0 deletions handlers/replicas_updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func ReplicaUpdater(c *client.Client) http.HandlerFunc {
return
}

w.WriteHeader(http.StatusAccepted)
}
}

Expand Down
3 changes: 3 additions & 0 deletions handlers/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,12 @@ func UpdateHandler(c *client.Client, maxRestarts uint64, restartDelay time.Durat
w.Write([]byte("Update error: " + err.Error()))
return
}

if response.Warnings != nil {
log.Println(response.Warnings)
}

w.WriteHeader(http.StatusAccepted)
}
}

Expand Down

0 comments on commit 7dc0494

Please sign in to comment.