8d6e9ae8ab451313eabf7f6c87d9435eedf702ac
hiram
  Fri Mar 29 11:13:19 2019 -0700
add chrom print out to track getData and fix up test harness to be more general refs #18869

diff --git src/hg/hubApi/getData.c src/hg/hubApi/getData.c
index 399c9e8..2dd587e 100644
--- src/hg/hubApi/getData.c
+++ src/hg/hubApi/getData.c
@@ -32,39 +32,41 @@
 
 static void tableDataOutput(char *db, struct trackDb *tdb,
     struct sqlConnection *conn, struct jsonWrite *jw, char *table,
     char *chrom, unsigned start, unsigned end)
 /* output the table data from the specified query string */
 {
 char query[4096];
 /* no chrom specified, return entire table */
 if (isEmpty(chrom))
     sqlSafef(query, sizeof(query), "select * from %s", table);
 else if (0 == (start + end))	/* have chrom, no start,end == full chr */
     {
     /* need to extend the chrom column check to allow tName also */
     if (! sqlColumnExists(conn, table, "chrom"))
 	apiErrAbort("track '%s' is not a position track, request track without chrom specification, genome: '%s'", table, db);
+    jsonWriteString(jw, "chrom", chrom);
     struct chromInfo *ci = hGetChromInfo(db, chrom);
     jsonWriteNumber(jw, "start", (long long)0);
     jsonWriteNumber(jw, "end", (long long)ci->size);
     sqlSafef(query, sizeof(query), "select * from %s where chrom='%s'", table, chrom);
     }
 else	/* fully specified chrom:start-end */
     {
     if (! sqlColumnExists(conn, table, "chrom"))
 	apiErrAbort("track '%s' is not a position track, request track without chrom specification, genome: '%s'", table, db);
+    jsonWriteString(jw, "chrom", chrom);
     jsonWriteNumber(jw, "start", (long long)start);
     jsonWriteNumber(jw, "end", (long long)end);
     if (startsWith("wig", tdb->type))
 	{
         wigTableDataOutput(jw, db, table, chrom, start, end);
         return;	/* DONE */
 	}
     else
 	{
 	sqlSafef(query, sizeof(query), "select * from %s where chrom='%s' AND chromEnd > %u AND chromStart < %u", table, chrom, start, end);
 	}
     }
 
 /* continuing, not a wiggle output */
 char **columnNames = NULL;