Skip to content

Commit

Permalink
Harmonizing output formats
Browse files Browse the repository at this point in the history
This adds the IP address to the first column of the CSV output.

Closes #85.
  • Loading branch information
fiorix committed Nov 18, 2014
1 parent 7a6500c commit cc079e0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func (f *CSVEncoder) Encode(w http.ResponseWriter, r *http.Request, q Query, ip
cw := csv.NewWriter(w)
cw.UseCRLF = f.UseCRLF
err := cw.Write([]string{
ip.String(),
record.CountryCode,
record.CountryName,
record.RegionCode,
Expand Down
2 changes: 1 addition & 1 deletion encoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestCSVEncoder(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if row[0] != "US" {
if row[1] != "US" {
t.Fatalf("Unexpected country code in record: %#v", row)
}
}
Expand Down
2 changes: 1 addition & 1 deletion freegeoip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func TestLookupXForwardedFor(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if row[0] != "US" {
if row[1] != "US" {
t.Fatalf("Unexpected country code in record: %#v", row)
}
}
Expand Down

0 comments on commit cc079e0

Please sign in to comment.