request/file.go

20 lines
335 B
Go
Raw Normal View History

package request
import (
"io/ioutil"
"log"
"os"
)
// File reads request json file
2019-10-27 14:22:17 +00:00
func File(path string) ([]byte, error) {
jsonFile, err := os.Open(path)
if err != nil {
2019-06-20 00:33:48 +00:00
log.Println("Error reading request. ", err)
2019-10-27 14:22:17 +00:00
return nil, err
}
defer jsonFile.Close()
byteValue, _ := ioutil.ReadAll(jsonFile)
2019-06-20 00:33:48 +00:00
return byteValue, nil
}