@@ -688,6 +688,40 @@ func TestResponse_cursorPagination(t *testing.T) {
688688 }
689689}
690690
691+ func TestResponse_beforeAfterPagination (t * testing.T ) {
692+ r := http.Response {
693+ Header : http.Header {
694+ "Link" : {`<https://api.github.com/?after=a1b2c3&before=>; rel="next",` +
695+ ` <https://api.github.com/?after=&before=>; rel="first",` +
696+ ` <https://api.github.com/?after=&before=d4e5f6>; rel="prev",` ,
697+ },
698+ },
699+ }
700+
701+ response := newResponse (& r )
702+ if got , want := response .Before , "d4e5f6" ; got != want {
703+ t .Errorf ("response.Before: %v, want %v" , got , want )
704+ }
705+ if got , want := response .After , "a1b2c3" ; got != want {
706+ t .Errorf ("response.After: %v, want %v" , got , want )
707+ }
708+ if got , want := response .FirstPage , 0 ; got != want {
709+ t .Errorf ("response.FirstPage: %v, want %v" , got , want )
710+ }
711+ if got , want := response .PrevPage , 0 ; want != got {
712+ t .Errorf ("response.PrevPage: %v, want %v" , got , want )
713+ }
714+ if got , want := response .NextPage , 0 ; want != got {
715+ t .Errorf ("response.NextPage: %v, want %v" , got , want )
716+ }
717+ if got , want := response .LastPage , 0 ; want != got {
718+ t .Errorf ("response.LastPage: %v, want %v" , got , want )
719+ }
720+ if got , want := response .NextPageToken , "" ; want != got {
721+ t .Errorf ("response.NextPageToken: %v, want %v" , got , want )
722+ }
723+ }
724+
691725func TestResponse_populatePageValues_invalid (t * testing.T ) {
692726 r := http.Response {
693727 Header : http.Header {
0 commit comments