diff --git a/curl.go b/curl.go index 1842483..24f362d 100644 --- a/curl.go +++ b/curl.go @@ -1,13 +1,14 @@ package main import ( + "bytes" "fmt" "io" "net" "net/http" ) -func curl(socket, method, path string) (io.ReadCloser, error) { +func curl(socket, method, path string, body []byte) (io.ReadCloser, error) { socketDial := func(proto, addr string) (conn net.Conn, err error) { return net.Dial("unix", socket) } @@ -19,11 +20,13 @@ func curl(socket, method, path string) (io.ReadCloser, error) { Transport: tr, } - req, err := http.NewRequest(method, path, nil) + req, err := http.NewRequest(method, path, bytes.NewReader(body)) if err != nil { return nil, fmt.Errorf("Error creating request: %w\n", err) } + req.Header.Add("Content-Type", "application/json") + resp, err := client.Do(req) if err != nil { return nil, fmt.Errorf("Error performing request: %w\n", err) diff --git a/index.html b/index.html index 2d6a9c5..b328440 100644 --- a/index.html +++ b/index.html @@ -21,7 +21,12 @@ +
+ +