diff options
Diffstat (limited to 'http.go')
-rw-r--r-- | http.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/http.go b/http.go index 9808f07..48c8dca 100644 --- a/http.go +++ b/http.go @@ -9,7 +9,6 @@ import ( "strings" tle "git.darknebu.la/Satellite/tle" - "github.com/gorilla/mux" ) // indexHandler displays an index page @@ -27,14 +26,14 @@ func dumpallHandler(w http.ResponseWriter, r *http.Request) { // get Handler returns the specified TLE func getHandler(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) + r.ParseForm() // define where the file containing the spoecified categories lies - categoryPath := fmt.Sprintf("data/%s.txt", vars["station"]) + categoryPath := fmt.Sprintf("data/%s.txt", r.FormValue("category")) // this will only download the category if the file does not exist or if it // is to old - downloadCategory(vars["station"]) + downloadCategory(r.FormValue("category")) // open the file containing the data for the individual station content, err := ioutil.ReadFile(categoryPath) @@ -47,7 +46,7 @@ func getHandler(w http.ResponseWriter, r *http.Request) { // iterate over all lines searching for the satellite var j int for i, line := range lines { - if strings.Contains(line, vars["name"]) { + if strings.Contains(line, r.FormValue("name")) { j = i break } |