@@ -620,14 +620,14 @@ func TestIssueService_DeleteLink(t *testing.T) {
620
620
func TestIssueService_Search (t * testing.T ) {
621
621
setup ()
622
622
defer teardown ()
623
- testMux .HandleFunc ("/rest/api/2/search " , func (w http.ResponseWriter , r * http.Request ) {
623
+ testMux .HandleFunc ("" , func (w http.ResponseWriter , r * http.Request ) {
624
624
testMethod (t , r , http .MethodGet )
625
- testRequestURL (t , r , "/rest/api/2 /search?expand=foo&jql=type+%3D+Bug+and+Status+NOT+IN+%28Resolved%29&maxResults=40&startAt=1" )
625
+ testRequestURL (t , r , "/rest/api/3 /search/jql ?expand=foo&jql=type+%3D+Bug+and+Status+NOT+IN+%28Resolved%29&maxResults=40&startAt=1" )
626
626
w .WriteHeader (http .StatusOK )
627
- fmt .Fprint (w , `{"expand": "schema,names","startAt": 1," maxResults": 40,"total": 6 ,"issues": [{"expand": "html","id": "10230","self": "http://kelpie9:8081/rest/api/2/issue/BULK-62","key": "BULK-62","fields": {"summary": "testing","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/5","id": "5","description": "The sub-task of the issue","iconUrl": "http://kelpie9:8081/images/icons/issue_subtask.gif","name": "Sub-task","subtask": true},"customfield_10071": null}},{"expand": "html","id": "10004","self": "http://kelpie9:8081/rest/api/2/issue/BULK-47","key": "BULK-47","fields": {"summary": "Cheese v1 2.0 issue","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/3","id": "3","description": "A task that needs to be done.","iconUrl": "http://kelpie9:8081/images/icons/task.gif","name": "Task","subtask": false}}}]}` )
627
+ fmt .Fprint (w , `{"expand": "schema,names","maxResults": 40,"issues": [{"expand": "html","id": "10230","self": "http://kelpie9:8081/rest/api/2/issue/BULK-62","key": "BULK-62","fields": {"summary": "testing","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/5","id": "5","description": "The sub-task of the issue","iconUrl": "http://kelpie9:8081/images/icons/issue_subtask.gif","name": "Sub-task","subtask": true},"customfield_10071": null}},{"expand": "html","id": "10004","self": "http://kelpie9:8081/rest/api/2/issue/BULK-47","key": "BULK-47","fields": {"summary": "Cheese v1 2.0 issue","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/3","id": "3","description": "A task that needs to be done.","iconUrl": "http://kelpie9:8081/images/icons/task.gif","name": "Task","subtask": false}}}]}` )
628
628
})
629
629
630
- opt := & SearchOptions {StartAt : 1 , MaxResults : 40 , Expand : "foo" }
630
+ opt := & SearchOptions {MaxResults : 40 }
631
631
_ , resp , err := testClient .Issue .Search (context .Background (), "type = Bug and Status NOT IN (Resolved)" , opt )
632
632
633
633
if resp == nil {
@@ -651,14 +651,14 @@ func TestIssueService_Search(t *testing.T) {
651
651
func TestIssueService_SearchEmptyJQL (t * testing.T ) {
652
652
setup ()
653
653
defer teardown ()
654
- testMux .HandleFunc ("/rest/api/2 /search" , func (w http.ResponseWriter , r * http.Request ) {
654
+ testMux .HandleFunc ("/rest/api/3 /search/jql " , func (w http.ResponseWriter , r * http.Request ) {
655
655
testMethod (t , r , http .MethodGet )
656
- testRequestURL (t , r , "/rest/api/2 /search?expand=foo&maxResults=40&startAt=1" )
656
+ testRequestURL (t , r , "/rest/api/3 /search/jql ?expand=foo&maxResults=40&startAt=1" )
657
657
w .WriteHeader (http .StatusOK )
658
- fmt .Fprint (w , `{"expand": "schema,names","startAt": 1," maxResults": 40,"total": 6 ,"issues": [{"expand": "html","id": "10230","self": "http://kelpie9:8081/rest/api/2/issue/BULK-62","key": "BULK-62","fields": {"summary": "testing","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/5","id": "5","description": "The sub-task of the issue","iconUrl": "http://kelpie9:8081/images/icons/issue_subtask.gif","name": "Sub-task","subtask": true},"customfield_10071": null}},{"expand": "html","id": "10004","self": "http://kelpie9:8081/rest/api/2/issue/BULK-47","key": "BULK-47","fields": {"summary": "Cheese v1 2.0 issue","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/3","id": "3","description": "A task that needs to be done.","iconUrl": "http://kelpie9:8081/images/icons/task.gif","name": "Task","subtask": false}}}]}` )
658
+ fmt .Fprint (w , `{"expand": "schema,names","maxResults": 40,"issues": [{"expand": "html","id": "10230","self": "http://kelpie9:8081/rest/api/2/issue/BULK-62","key": "BULK-62","fields": {"summary": "testing","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/5","id": "5","description": "The sub-task of the issue","iconUrl": "http://kelpie9:8081/images/icons/issue_subtask.gif","name": "Sub-task","subtask": true},"customfield_10071": null}},{"expand": "html","id": "10004","self": "http://kelpie9:8081/rest/api/2/issue/BULK-47","key": "BULK-47","fields": {"summary": "Cheese v1 2.0 issue","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/3","id": "3","description": "A task that needs to be done.","iconUrl": "http://kelpie9:8081/images/icons/task.gif","name": "Task","subtask": false}}}]}` )
659
659
})
660
660
661
- opt := & SearchOptions {StartAt : 1 , MaxResults : 40 , Expand : "foo" }
661
+ opt := & SearchOptions {MaxResults : 40 }
662
662
_ , resp , err := testClient .Issue .Search (context .Background (), "" , opt )
663
663
664
664
if resp == nil {
@@ -682,9 +682,9 @@ func TestIssueService_SearchEmptyJQL(t *testing.T) {
682
682
func TestIssueService_Search_WithoutPaging (t * testing.T ) {
683
683
setup ()
684
684
defer teardown ()
685
- testMux .HandleFunc ("/rest/api/2 /search" , func (w http.ResponseWriter , r * http.Request ) {
685
+ testMux .HandleFunc ("/rest/api/3 /search/jql " , func (w http.ResponseWriter , r * http.Request ) {
686
686
testMethod (t , r , http .MethodGet )
687
- testRequestURL (t , r , "/rest/api/2 /search?jql=something" )
687
+ testRequestURL (t , r , "/rest/api/3 /search/jql ?jql=something" )
688
688
w .WriteHeader (http .StatusOK )
689
689
fmt .Fprint (w , `{"expand": "schema,names","startAt": 0,"maxResults": 50,"total": 6,"issues": [{"expand": "html","id": "10230","self": "http://kelpie9:8081/rest/api/2/issue/BULK-62","key": "BULK-62","fields": {"summary": "testing","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/5","id": "5","description": "The sub-task of the issue","iconUrl": "http://kelpie9:8081/images/icons/issue_subtask.gif","name": "Sub-task","subtask": true},"customfield_10071": null}},{"expand": "html","id": "10004","self": "http://kelpie9:8081/rest/api/2/issue/BULK-47","key": "BULK-47","fields": {"summary": "Cheese v1 2.0 issue","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/3","id": "3","description": "A task that needs to be done.","iconUrl": "http://kelpie9:8081/images/icons/task.gif","name": "Task","subtask": false}}}]}` )
690
690
})
@@ -711,26 +711,26 @@ func TestIssueService_Search_WithoutPaging(t *testing.T) {
711
711
func TestIssueService_SearchPages (t * testing.T ) {
712
712
setup ()
713
713
defer teardown ()
714
- testMux .HandleFunc ("/rest/api/2 /search" , func (w http.ResponseWriter , r * http.Request ) {
714
+ testMux .HandleFunc ("/rest/api/3 /search/jql " , func (w http.ResponseWriter , r * http.Request ) {
715
715
testMethod (t , r , http .MethodGet )
716
- if r .URL .String () == "/rest/api/2 /search?expand=foo&jql=something&maxResults=2&startAt=1&validateQuery=warn" {
716
+ if r .URL .String () == "/rest/api/3 /search/jql ?expand=foo&jql=something&maxResults=2&startAt=1&validateQuery=warn" {
717
717
w .WriteHeader (http .StatusOK )
718
718
fmt .Fprint (w , `{"expand": "schema,names","startAt": 1,"maxResults": 2,"total": 6,"issues": [{"expand": "html","id": "10230","self": "http://kelpie9:8081/rest/api/2/issue/BULK-62","key": "BULK-62","fields": {"summary": "testing","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/5","id": "5","description": "The sub-task of the issue","iconUrl": "http://kelpie9:8081/images/icons/issue_subtask.gif","name": "Sub-task","subtask": true},"customfield_10071": null}},{"expand": "html","id": "10004","self": "http://kelpie9:8081/rest/api/2/issue/BULK-47","key": "BULK-47","fields": {"summary": "Cheese v1 2.0 issue","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/3","id": "3","description": "A task that needs to be done.","iconUrl": "http://kelpie9:8081/images/icons/task.gif","name": "Task","subtask": false}}}]}` )
719
719
return
720
- } else if r .URL .String () == "/rest/api/2 /search?expand=foo&jql=something&maxResults=2&startAt=3&validateQuery=warn" {
720
+ } else if r .URL .String () == "/rest/api/3 /search/jql ?expand=foo&jql=something&maxResults=2&startAt=3&validateQuery=warn" {
721
721
w .WriteHeader (http .StatusOK )
722
722
fmt .Fprint (w , `{"expand": "schema,names","startAt": 3,"maxResults": 2,"total": 6,"issues": [{"expand": "html","id": "10230","self": "http://kelpie9:8081/rest/api/2/issue/BULK-62","key": "BULK-62","fields": {"summary": "testing","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/5","id": "5","description": "The sub-task of the issue","iconUrl": "http://kelpie9:8081/images/icons/issue_subtask.gif","name": "Sub-task","subtask": true},"customfield_10071": null}},{"expand": "html","id": "10004","self": "http://kelpie9:8081/rest/api/2/issue/BULK-47","key": "BULK-47","fields": {"summary": "Cheese v1 2.0 issue","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/3","id": "3","description": "A task that needs to be done.","iconUrl": "http://kelpie9:8081/images/icons/task.gif","name": "Task","subtask": false}}}]}` )
723
723
return
724
- } else if r .URL .String () == "/rest/api/2 /search?expand=foo&jql=something&maxResults=2&startAt=5&validateQuery=warn" {
724
+ } else if r .URL .String () == "/rest/api/3 /search/jql ?expand=foo&jql=something&maxResults=2&startAt=5&validateQuery=warn" {
725
725
w .WriteHeader (http .StatusOK )
726
- fmt .Fprint (w , `{"expand": "schema,names","startAt": 5," maxResults": 2,"total": 6 ,"issues": [{"expand": "html","id": "10230","self": "http://kelpie9:8081/rest/api/2/issue/BULK-62","key": "BULK-62","fields": {"summary": "testing","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/5","id": "5","description": "The sub-task of the issue","iconUrl": "http://kelpie9:8081/images/icons/issue_subtask.gif","name": "Sub-task","subtask": true},"customfield_10071": null}}]}` )
726
+ fmt .Fprint (w , `{"expand": "schema,names","maxResults": 2,"issues": [{"expand": "html","id": "10230","self": "http://kelpie9:8081/rest/api/2/issue/BULK-62","key": "BULK-62","fields": {"summary": "testing","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/5","id": "5","description": "The sub-task of the issue","iconUrl": "http://kelpie9:8081/images/icons/issue_subtask.gif","name": "Sub-task","subtask": true},"customfield_10071": null}}]}` )
727
727
return
728
728
}
729
729
730
730
t .Errorf ("Unexpected URL: %v" , r .URL )
731
731
})
732
732
733
- opt := & SearchOptions {StartAt : 1 , MaxResults : 2 , Expand : "foo" , ValidateQuery : "warn" }
733
+ opt := & SearchOptions {MaxResults : 2 }
734
734
issues := make ([]Issue , 0 )
735
735
err := testClient .Issue .SearchPages (context .Background (), "something" , opt , func (issue Issue ) error {
736
736
issues = append (issues , issue )
@@ -749,19 +749,19 @@ func TestIssueService_SearchPages(t *testing.T) {
749
749
func TestIssueService_SearchPages_EmptyResult (t * testing.T ) {
750
750
setup ()
751
751
defer teardown ()
752
- testMux .HandleFunc ("/rest/api/2 /search" , func (w http.ResponseWriter , r * http.Request ) {
752
+ testMux .HandleFunc ("/rest/api/3 /search/jql " , func (w http.ResponseWriter , r * http.Request ) {
753
753
testMethod (t , r , http .MethodGet )
754
- if r .URL .String () == "/rest/api/2 /search?expand=foo&jql=something&maxResults=50&startAt=1&validateQuery=warn" {
754
+ if r .URL .String () == "/rest/api/3 /search/jql ?expand=foo&jql=something&maxResults=50&startAt=1&validateQuery=warn" {
755
755
w .WriteHeader (http .StatusOK )
756
756
// This is what Jira outputs when the &maxResult= issue occurs. It used to cause SearchPages to go into an endless loop.
757
- fmt .Fprint (w , `{"expand": "schema,names","startAt": 0," maxResults": 0,"total": 6 ,"issues": []}` )
757
+ fmt .Fprint (w , `{"expand": "schema,names","maxResults": 0,"issues": []}` )
758
758
return
759
759
}
760
760
761
761
t .Errorf ("Unexpected URL: %v" , r .URL )
762
762
})
763
763
764
- opt := & SearchOptions {StartAt : 1 , MaxResults : 50 , Expand : "foo" , ValidateQuery : "warn" }
764
+ opt := & SearchOptions {MaxResults : 50 }
765
765
issues := make ([]Issue , 0 )
766
766
err := testClient .Issue .SearchPages (context .Background (), "something" , opt , func (issue Issue ) error {
767
767
issues = append (issues , issue )
0 commit comments