chore: remove refs to deprecated io/ioutil

Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
This commit is contained in:
guoguangwu
2023-10-19 11:05:38 +08:00
parent 958b0671bd
commit 115e48a202
12 changed files with 56 additions and 59 deletions
+2 -2
View File
@@ -18,7 +18,7 @@ package control
import (
"encoding/json"
"io/ioutil"
"io"
"net/http"
"github.com/google/uuid"
@@ -103,7 +103,7 @@ var pathValidator func(string) error = func(path string) error {
func addRoute(res http.ResponseWriter, req *http.Request) {
var route model.Route
payload, _ := ioutil.ReadAll(req.Body)
payload, _ := io.ReadAll(req.Body)
err := json.Unmarshal(payload, &route)
if err != nil {
httperror.ErrorJSON(res, "Malformed JSON", http.StatusBadRequest)