Cleanup
This commit is contained in:
43
main.go
43
main.go
@@ -1,10 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -17,27 +14,27 @@ func main() {
|
||||
log.SetFlags(log.Lmicroseconds)
|
||||
log.Println(FULL_URL)
|
||||
|
||||
res, err := http.Get(FULL_URL)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer res.Body.Close()
|
||||
body, err := io.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
log.Printf("Error reading response body: %+v\n", err)
|
||||
return
|
||||
}
|
||||
if res.StatusCode != http.StatusOK {
|
||||
log.Printf("Non-OK HTTP status: %d\nResponse body: %s\n", res.StatusCode, body)
|
||||
return
|
||||
}
|
||||
// res, err := http.Get(FULL_URL)
|
||||
// if err != nil {
|
||||
// log.Fatal(err)
|
||||
// }
|
||||
// defer res.Body.Close()
|
||||
// body, err := io.ReadAll(res.Body)
|
||||
// if err != nil {
|
||||
// log.Printf("Error reading response body: %+v\n", err)
|
||||
// return
|
||||
// }
|
||||
// if res.StatusCode != http.StatusOK {
|
||||
// log.Printf("Non-OK HTTP status: %d\nResponse body: %s\n", res.StatusCode, body)
|
||||
// return
|
||||
// }
|
||||
|
||||
var data APIResponse
|
||||
err = json.Unmarshal(body, &data)
|
||||
if err != nil {
|
||||
log.Printf("Error unmarshaling JSON: %+v\n", err)
|
||||
return
|
||||
}
|
||||
// var data APIResponse
|
||||
// err = json.Unmarshal(body, &data)
|
||||
// if err != nil {
|
||||
// log.Printf("Error unmarshaling JSON: %+v\n", err)
|
||||
// return
|
||||
// }
|
||||
// log.Printf("Data: %+v\n", data)
|
||||
|
||||
listener := new(RealtimeListener)
|
||||
|
||||
Reference in New Issue
Block a user