Skip to content

Files

Latest commit

 

History

History

http

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

go-utils Http

The go-utils Http package provides handy methods to use api end points using http protocol.

Installation

To use the log package you must import the package.

import "github.com/eliona-smart-building-assistant/go-utils/http"

Usage

After installation, you can read payload from http end points.

import "github.com/eliona-smart-building-assistant/go-utils/http"

For example, you can make a request and read current weather conditions from this endpoint.

payload, err := http.Read(http.NewRequest("https://weatherdbi.herokuapp.com/data/weather/winterthur"), 10, true)
var result map[string]interface{}
_ = json.Unmarshal(payload, &result)
fmt.Printf(result["currentConditions"].(map[string]interface{})["comment"].(string))