Skip to content

Commit

Permalink
fix: test element http req
Browse files Browse the repository at this point in the history
  • Loading branch information
saman2000hoseini committed Jul 11, 2023
1 parent 99fbac1 commit 655179c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/webhook-proxy/handler/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ func (p *Proxy) ProxyToElement(c echo.Context) error {
return c.NoContent(http.StatusInternalServerError)
}

func (p *Proxy) proxyRequest(body []byte, url string) bool {
func (p *Proxy) proxyRequest(jiraBody []byte, url string) bool {
body, err := json.Marshal(elementBody{
Text: "test",
DisplayName: DisplayName,
})
if err != nil {
logrus.Errorf("proxy request to element error: %s", err)
logrus.Errorf("marshal request body error: %s", err)
return false
}

proxyReq, err := http.NewRequest(http.MethodPost, url, bytes.NewReader(body))
if err != nil {
logrus.Errorf("proxy request to element error: %s", err)
logrus.Errorf("create proxy request error: %s", err)
return false
}

Expand All @@ -69,10 +69,10 @@ func (p *Proxy) proxyRequest(body []byte, url string) bool {

responseBody, err := io.ReadAll(resp.Body)
if err != nil {
logrus.Errorf("proxy request to element error: %s", err)
logrus.Errorf("element response body read error: %s", err)
return false
}

logrus.Errorf("proxy request to element error: %s", responseBody)
logrus.Errorf("element response body read error: %s", responseBody)
return false
}

0 comments on commit 655179c

Please sign in to comment.