mirror of
https://github.com/SourceFellows/gobuch.git
synced 2024-10-22 22:05:35 +00:00
27 lines
473 B
Go
27 lines
473 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io/ioutil"
|
|
"log"
|
|
"net/http"
|
|
|
|
"github.com/moogar0880/problems"
|
|
)
|
|
|
|
func main() {
|
|
res, err := http.Get("http://localhost:8080/a")
|
|
if err != nil {
|
|
log.Fatal("could not request")
|
|
}
|
|
defer res.Body.Close()
|
|
if res.StatusCode != http.StatusOK {
|
|
problem := &problems.DefaultProblem{}
|
|
bites, _ := ioutil.ReadAll(res.Body)
|
|
json.Unmarshal(bites, problem)
|
|
log.Println(problem.ProblemTitle())
|
|
} else {
|
|
log.Println("ok")
|
|
}
|
|
}
|