Skip to content

Commit

Permalink
Merge pull request #6179 from anita-87/main
Browse files Browse the repository at this point in the history
Reto #10 - Go
  • Loading branch information
kontroldev authored Dec 31, 2023
2 parents dab37c0 + fa0df5b commit 6b63ff6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Retos/Reto #10 - LA API [Media]/go/anita-87.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package main

import (
"io"
"log"
"net/http"
)

func main() {
c := http.Client{}

resp, err := c.Get("https://uselessfacts.jsph.pl/api/v2/facts/random")
if err != nil {
log.Fatalf("Error: %v", err)
}
defer resp.Body.Close()

data, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatalf("Error: %v", err)
}

log.Printf("Response: %v", string(data))
}

0 comments on commit 6b63ff6

Please sign in to comment.