package api import ( "bytes" "encoding/json" "io" "net/http" ) func PostRequest(url string, model any) ([]byte, error) { uJson, err := json.Marshal(model) if err != nil { return nil, err } resp, err := http.Post(url, "application/json", bytes.NewReader(uJson)) if err != nil { return nil, err } data, err := io.ReadAll(resp.Body) if err != nil { return nil, err } return data, nil }