mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-01-01 01:34:25 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53a4e67f70 |
@@ -7,6 +7,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"reflect"
|
"reflect"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/bitechdev/ResolveSpec/pkg/common"
|
"github.com/bitechdev/ResolveSpec/pkg/common"
|
||||||
@@ -133,9 +134,15 @@ func (h *Handler) Handle(w common.ResponseWriter, r common.Request, params map[s
|
|||||||
h.sendError(w, http.StatusBadRequest, "invalid_request", "Invalid request body", err)
|
h.sendError(w, http.StatusBadRequest, "invalid_request", "Invalid request body", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
h.handleCreate(ctx, w, data, options)
|
validId, _ := strconv.ParseInt(id, 10, 64)
|
||||||
|
if validId > 0 {
|
||||||
|
h.handleUpdate(ctx, w, id, nil, data, options)
|
||||||
|
} else {
|
||||||
|
h.handleCreate(ctx, w, data, options)
|
||||||
|
}
|
||||||
case "PUT", "PATCH":
|
case "PUT", "PATCH":
|
||||||
// Update operation
|
// Update operation
|
||||||
|
|
||||||
body, err := r.Body()
|
body, err := r.Body()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("Failed to read request body: %v", err)
|
logger.Error("Failed to read request body: %v", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user