Skip to content

Commit

Permalink
Bug Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashish Bhat committed Jul 26, 2019
1 parent 51d4490 commit 6b471a4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions repository/Repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,13 @@ func PaginateForWeb(w http.ResponseWriter, r *http.Request) QueryProcessor {
db = db.Offset(offset)
}

var totalRecords int
db.Model(out).Count(&totalRecords)
if out != nil {
var totalRecords int
db.Model(out).Count(&totalRecords)

w.Header().Set("X-Total-Count", strconv.Itoa(totalRecords))
}

w.Header().Set("X-Total-Count", strconv.Itoa(totalRecords))
return db, nil
}
}
Expand Down

0 comments on commit 6b471a4

Please sign in to comment.