start using a standard http PB

This commit is contained in:
Jeff Carr 2025-09-07 19:14:50 -05:00
parent 97fe127345
commit 6a99b7b099
1 changed files with 16 additions and 0 deletions

View File

@ -11,6 +11,22 @@ import (
"go.wit.com/log"
)
func (p *Repos) SendReply(w http.ResponseWriter, reqPB *httppb.HttpRequest) error {
data, err := p.Marshal()
if err != nil {
reqPB.Errors = append(reqPB.Errors, log.Sprintf("%v", err))
}
if len(data) == 0 {
reqPB.Errors = append(reqPB.Errors, "Patches PB data was nil/emtpy without Marsha() error")
return nil
}
i, err := w.Write(data)
if err != nil {
reqPB.Errors = append(reqPB.Errors, log.Sprintf("i=%d %v", i, err))
}
return err
}
func (p *Repos) HttpPost(baseURL string, route string) (*Repos, 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