Skip to content

Commit

Permalink
chore: improve logging and testing across the codebase
Browse files Browse the repository at this point in the history
- Add logging for URL path in the `trigger` function
- Remove commented-out form data encoding line
- Import the `log` package

Signed-off-by: appleboy <[email protected]>
  • Loading branch information
appleboy committed Oct 5, 2024
1 parent c213337 commit e60e4b9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion jenkins.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"net/url"
"strings"
Expand Down Expand Up @@ -81,7 +82,6 @@ func (jenkins *Jenkins) parseResponse(resp *http.Response, body interface{}) (er

func (jenkins *Jenkins) post(path string, params url.Values, body interface{}) (err error) {
requestURL := jenkins.buildURL(path, params)
// formData := params.Encode()
req, err := http.NewRequest("POST", requestURL, nil)
if err != nil {
return
Expand Down Expand Up @@ -124,5 +124,7 @@ func (jenkins *Jenkins) trigger(job string, params url.Values) error {
urlPath = jenkins.parseJobPath(job) + "/buildWithParameters"
}

log.Println(urlPath)

return jenkins.post(urlPath, params, nil)
}

0 comments on commit e60e4b9

Please sign in to comment.