06ce406a7fe0566c6f6984b445c9035088c1bd38
hiram
Mon Feb 11 15:17:30 2019 -0800
now with correct application/json content type header refs #18869
diff --git src/hg/hubApi/hubApi.c src/hg/hubApi/hubApi.c
index d67abcf..a554615 100644
--- src/hg/hubApi/hubApi.c
+++ src/hg/hubApi/hubApi.c
@@ -876,36 +876,40 @@
getDbAndGenome(cart, &database, &genome, oldVars);
initGenbankTableNames(database);
char *docRoot = cfgOptionDefault("browser.documentRoot", DOCUMENT_ROOT);
int timeout = cartUsualInt(cart, "udcTimeout", 300);
if (udcCacheTimeout() < timeout)
udcSetCacheTimeout(timeout);
knetUdcInstall();
char *pathInfo = getenv("PATH_INFO");
if (isNotEmpty(pathInfo))
{
+ puts("Content-Type:application/json");
+ puts("\n");
/* skip the first leading slash to simplify chopByChar parsing */
pathInfo += 1;
setupFunctionHash();
apiFunctionSwitch(pathInfo);
return;
}
+puts("Content-Type:text/html");
+puts("\n");
struct dbDb *dbList = ucscDbDb();
char **ucscDbList = NULL;
int listSize = slCount(dbList);
AllocArray(ucscDbList, listSize);
struct dbDb *el = dbList;
int ucscDataBaseCount = 0;
int maxDbNameWidth = 0;
for ( ; el != NULL; el = el->next )
{
ucscDbList[ucscDataBaseCount++] = el->name;
if (strlen(el->name) > maxDbNameWidth)
maxDbNameWidth = strlen(el->name);
}
maxDbNameWidth += 1;
@@ -925,32 +929,32 @@
long lastTime = clock1000();
struct trackHub *hub = trackHubOpen(urlInput, "");
if (measureTiming)
{
long thisTime = clock1000();
hPrintf("hub open time: %ld millis
\n", thisTime - lastTime);
}
hPrintf("
\n"); cartDump(cart); hPrintf("\n"); hPrintf("