small changes
This commit is contained in:
parent
4a4e5830f6
commit
10a196533e
14
main.go
14
main.go
@ -52,15 +52,15 @@ func Register(writer http.ResponseWriter, request *http.Request) {
|
||||
if err != nil {
|
||||
fmt.Printf("Error parsing URL parameters: %s\n", err)
|
||||
writer.WriteHeader(http.StatusInternalServerError)
|
||||
fmt.Printf("{\"error\": \"%s\"}", err)
|
||||
fmt.Fprintf(writer, "{\"error\": \"%s\"}", err)
|
||||
return
|
||||
}
|
||||
|
||||
usernameArr, ok := params["username"]
|
||||
if !ok {
|
||||
fmt.Printf("Error parsing URL parameters: %s\n", err)
|
||||
writer.WriteHeader(http.StatusInternalServerError)
|
||||
fmt.Printf("{\"error\": \"%s\"}", err)
|
||||
fmt.Println("username GET param not found")
|
||||
writer.WriteHeader(http.StatusBadRequest)
|
||||
fmt.Fprintf(writer, "{\"error\": \"username not found\"}")
|
||||
return
|
||||
}
|
||||
username := usernameArr[0]
|
||||
@ -82,7 +82,7 @@ func Register(writer http.ResponseWriter, request *http.Request) {
|
||||
if err != nil {
|
||||
fmt.Printf("Error in JSON marshal: %s\n", err)
|
||||
writer.WriteHeader(http.StatusInternalServerError)
|
||||
fmt.Printf("{\"error\": \"%s\"}", err)
|
||||
fmt.Fprintf(writer, "{\"error\": \"%s\"}", err)
|
||||
return
|
||||
}
|
||||
|
||||
@ -90,3 +90,7 @@ func Register(writer http.ResponseWriter, request *http.Request) {
|
||||
|
||||
fmt.Fprintf(writer, "%s", jsonData)
|
||||
}
|
||||
|
||||
func ValidateId(writer http.ResponseWriter, request *http.Request) {
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user