2019-06-13 17:11:42 +00:00
|
|
|
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) {
|
2019-06-13 17:11:42 +00:00
|
|
|
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
|
2019-06-13 17:11:42 +00:00
|
|
|
}
|
|
|
|
defer jsonFile.Close()
|
|
|
|
byteValue, _ := ioutil.ReadAll(jsonFile)
|
2019-06-20 00:33:48 +00:00
|
|
|
return byteValue, nil
|
2019-06-13 17:11:42 +00:00
|
|
|
}
|