move some stuff around

This commit is contained in:
2026-07-24 21:11:33 -07:00
parent 0064294c3c
commit 98c8b453a0
3 changed files with 36 additions and 28 deletions
+48
View File
@@ -0,0 +1,48 @@
package main
import (
"fmt"
"io"
"log"
"net/http"
"strings"
)
func main() {
read_config()
client := &http.Client{}
xml := `<?xml version="1.0" encoding="UTF-8"?>
<d:propfind xmlns:d="DAV:">
<d:prop>
<d:displayname/>
<d:resourcetype/>
</d:prop>
</d:propfind>`
body := strings.NewReader(xml)
req, _ := http.NewRequest(
"PROPFIND",
serverConfig.URL+"/dav/cal/"+convert_username_into_url(serverConfig.Username),
body,
)
req.SetBasicAuth(serverConfig.Username, serverConfig.Password)
req.Header.Set("Depth", "1")
req.Header.Set("Content-Type", "application/xml")
resp, err := client.Do(req)
if err != nil {
fmt.Print(err.Error())
}
defer resp.Body.Close()
body2, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(string(body2))
}