Verbose flag added
This commit is contained in:
parent
c5811d75b7
commit
020ac7a6fb
3 changed files with 48 additions and 1 deletions
12
jkl.go
12
jkl.go
|
|
@ -3,6 +3,7 @@ package jkl
|
|||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
|
@ -14,6 +15,7 @@ import (
|
|||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
var Verbose *bool
|
||||
var defaultIssue = &JiraIssue{}
|
||||
|
||||
func bootHttpClient() {
|
||||
|
|
@ -68,6 +70,16 @@ func List(jql string) ([]*JiraIssue, error) {
|
|||
fmt.Println(err)
|
||||
return nil, err
|
||||
}
|
||||
if resp.StatusCode >= 400 {
|
||||
fmt.Println("Status code:", resp.StatusCode)
|
||||
fmt.Println("Response:")
|
||||
b, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fmt.Println(string(b))
|
||||
return nil, errors.New("Some http error happened.")
|
||||
}
|
||||
dec := json.NewDecoder(resp.Body)
|
||||
var issues = &Search{}
|
||||
err = dec.Decode(issues)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue