summaryrefslogtreecommitdiff
path: root/repo.http.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-08 03:38:03 -0500
committerJeff Carr <[email protected]>2025-09-08 03:38:03 -0500
commitf9c8a37491c06825db17faa8d11e7413c342b40b (patch)
tree36373f2f021488f215fb57e0e72af9816e34b718 /repo.http.go
parent6a99b7b099f88edda7e9a4156e3c25750fd4a80e (diff)
http autogen testing
Diffstat (limited to 'repo.http.go')
-rw-r--r--repo.http.go22
1 files changed, 15 insertions, 7 deletions
diff --git a/repo.http.go b/repo.http.go
index d878dc0..794ee43 100644
--- a/repo.http.go
+++ b/repo.http.go
@@ -1,11 +1,7 @@
package gitpb
import (
- "bytes"
"net/http"
- "net/url"
- "os"
- "os/user"
"go.wit.com/lib/protobuf/httppb"
"go.wit.com/log"
@@ -27,7 +23,9 @@ func (p *Repos) SendReply(w http.ResponseWriter, reqPB *httppb.HttpRequest) erro
return err
}
-func (p *Repos) HttpPost(baseURL string, route string) (*Repos, error) {
+/*
+// err handling here isn't great
+func (p *Repos) HttpPost(baseURL string, route string) (*Repos, *httppb.HttpRequest, error) {
// if you ever have "http://www.wit.com//" GO will regect the server recieving it.
// Even though the linux kernel gets the network payload
// also it never gives you an error about that, it just goes away invisably inside GO
@@ -42,7 +40,7 @@ func (p *Repos) HttpPost(baseURL string, route string) (*Repos, error) {
log.Info("reposs PB HttpPost", finalURL.String())
req, err = http.NewRequest(http.MethodPost, finalURL.String(), bytes.NewBuffer(data))
if req == nil {
- return nil, err
+ return nil, nil, err
}
usr, _ := user.Current()
@@ -52,9 +50,19 @@ func (p *Repos) HttpPost(baseURL string, route string) (*Repos, error) {
newdata, err := httppb.PostReq(req)
+ reqPB, err2 := httppb.ReqToPB(req)
+ reqPB.URL = finalURL.String()
+ if err != nil {
+ reqPB.Errors = append(reqPB.Errors, fmt.Sprintf("%v", err))
+ }
+ if err2 != nil {
+ reqPB.Errors = append(reqPB.Errors, fmt.Sprintf("%v", err2))
+ }
+
newpb := NewRepos()
err = newpb.Unmarshal(newdata)
log.Infof("repos PB HttpPost %s sent len(%d) got len(%d)\n", finalURL.String(), p.Len(), newpb.Len())
- return newpb, err
+ return newpb, reqPB, err
}
+*/