mirror of
https://github.com/alvierahman90/gohookr.git
synced 2024-12-04 08:31:58 +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"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
@ -32,7 +31,7 @@ func main() {
|
|||||||
checkSignature = p != "true"
|
checkSignature = p != "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
raw_config, err := ioutil.ReadFile(config_filename)
|
raw_config, err := os.ReadFile(config_filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err.Error())
|
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
|
// Read payload or return 500 if that doesn't work out
|
||||||
payload := ""
|
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")
|
writeResponse(w, 500, "Internal Server Error: Could not read payload")
|
||||||
fmt.Println("Error: Could not read payload")
|
fmt.Println("Error: Could not read payload")
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user