mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-03-03 12:57:36 +08:00
Move httpError func to generic.go
This commit is contained in:
parent
01c037a7a2
commit
422a850354
11
api/error.go
11
api/error.go
@ -1,11 +0,0 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func httpError(w http.ResponseWriter, r *http.Request, err error, code int) {
|
||||
log.Printf("%s: %s\n", r.URL.Path, err)
|
||||
http.Error(w, err.Error(), code)
|
||||
}
|
@ -5,6 +5,7 @@ import (
|
||||
"encoding/gob"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
@ -263,6 +264,11 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
func httpError(w http.ResponseWriter, r *http.Request, err error, code int) {
|
||||
log.Printf("%s: %s\n", r.URL.Path, err)
|
||||
http.Error(w, err.Error(), code)
|
||||
}
|
||||
|
||||
// auth
|
||||
|
||||
type GenericAuthRequest struct {
|
||||
|
Loading…
x
Reference in New Issue
Block a user