diff --git a/repo.http.go b/repo.http.go index 2260d01..d878dc0 100644 --- a/repo.http.go +++ b/repo.http.go @@ -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