Documentation
¶
Overview ¶
Package online is for simple HTTP interactions with the GitHub API. It is used to fetch the latest release information of the program.
Index ¶
Examples ¶
Constants ¶
View Source
const ( // ReleaseAPI GitHub API v3 releases endpoint. // See: https://developer.github.com/v3/repos/releases/ ReleaseAPI = "https://api.github.com/repos/bengarrett/retrotxtgo/releases/latest" )
Variables ¶
View Source
var ( ErrJSON = errors.New("the response body syntax is not json") ErrMash = errors.New("cannot unmarshal the json response body") )
Functions ¶
func Get ¶
Get fetches a URL and returns both its response and body. If an etag is provided a "If-None-Match" header request will be included.
func Ping ¶
Ping requests a URL and reports whether if the status is successful. A server response status code between 200 and 299 is considered a success.
Example ¶
package main import ( "fmt" "github.com/bengarrett/retrotxtgo/pkg/online" ) func main() { ok, _ := online.Ping("https://example.org") fmt.Print(ok) }
Output: true
Types ¶
Click to show internal directories.
Click to hide internal directories.