Added dotenv parsing, cleared up style errors.
This commit is contained in:
@@ -18,19 +18,19 @@ func HttpGetPostInt(request *http.Request, key string) (value int, error error)
|
||||
case "POST":
|
||||
error = request.ParseForm()
|
||||
if error != nil {
|
||||
error = fmt.Errorf("Unable to parse HTTP POST input: %s",
|
||||
error = fmt.Errorf("unable to parse post input: %s",
|
||||
error.Error())
|
||||
return
|
||||
}
|
||||
value, error = strconv.Atoi(request.Form.Get(key))
|
||||
if error != nil {
|
||||
fmt.Printf("Error parsing parameter '%s'\n", key)
|
||||
error = fmt.Errorf("Unable to parse parameter '%s' as an integer: %s",
|
||||
error = fmt.Errorf("unable to parse parameter '%s' as an integer: %s",
|
||||
key, error.Error())
|
||||
}
|
||||
return
|
||||
default:
|
||||
error = fmt.Errorf("This endpoint does not support %s operations.\n", request.Method)
|
||||
error = fmt.Errorf("this endpoint does not support %s operations", request.Method)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,6 @@ func HttFibonacci(w http.ResponseWriter, request *http.Request) {
|
||||
fmt.Fprintf(w, "Fibonacci sequence index [%d]: %d\n",
|
||||
seq, MyFibonacci(seq))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func HttSum(w http.ResponseWriter, request *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user