mirror of
https://github.com/alvierahman90/gohookr.git
synced 2024-12-03 17:11:59 +00:00
stop using deprecated ioutil
This commit is contained in:
parent
0f8b4d2e1e
commit
e74c3a684e
5
main.go
5
main.go
@ -7,7 +7,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
@ -32,7 +31,7 @@ func main() {
|
||||
checkSignature = p != "true"
|
||||
}
|
||||
|
||||
raw_config, err := ioutil.ReadFile(config_filename)
|
||||
raw_config, err := os.ReadFile(config_filename)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
@ -61,7 +60,7 @@ func webhookHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// Read payload or return 500 if that doesn't work out
|
||||
payload := ""
|
||||
if p, err := ioutil.ReadAll(r.Body); err != nil {
|
||||
if p, err := io.ReadAll(r.Body); err != nil {
|
||||
writeResponse(w, 500, "Internal Server Error: Could not read payload")
|
||||
fmt.Println("Error: Could not read payload")
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user