mirror of
https://codeberg.org/scip/anydb.git
synced 2026-02-04 09:20:58 +01:00
fix more liniting errors
This commit is contained in:
@@ -148,5 +148,8 @@ func RestSet(resp http.ResponseWriter, req *http.Request, conf *cfg.Config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Home(resp http.ResponseWriter) {
|
func Home(resp http.ResponseWriter) {
|
||||||
resp.Write([]byte("Use the REST API on " + apiprefix + "\r\n"))
|
_, err := resp.Write([]byte("Use the REST API on " + apiprefix + "\r\n"))
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package rest
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"codeberg.org/scip/anydb/cfg"
|
"codeberg.org/scip/anydb/cfg"
|
||||||
@@ -78,10 +79,14 @@ func JsonStatus(resp http.ResponseWriter, code int, msg string) {
|
|||||||
resp.Header().Set("Content-Type", "application/json")
|
resp.Header().Set("Content-Type", "application/json")
|
||||||
resp.WriteHeader(code)
|
resp.WriteHeader(code)
|
||||||
|
|
||||||
json.NewEncoder(resp).Encode(
|
err := json.NewEncoder(resp).Encode(
|
||||||
Result{
|
Result{
|
||||||
Code: code,
|
Code: code,
|
||||||
Message: msg,
|
Message: msg,
|
||||||
Success: success,
|
Success: success,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user