mirror of
https://github.com/appleboy/drone-jenkins.git
synced 2026-06-04 18:23:57 +08:00
chore: improve logging and testing across the codebase
- Add logging for URL path in the `trigger` function - Remove commented-out form data encoding line - Import the `log` package Signed-off-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
+3
-1
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
@@ -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
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user