742efb6ff310c75a30cf13088111139cf713b9db angie Tue Feb 23 11:06:52 2016 -0800 Unifying some triplicate code to print an HTTP error 400 response (Bad Request) and exit. diff --git src/hg/lib/api.c src/hg/lib/api.c index c1672d4..e63ae0e 100644 --- src/hg/lib/api.c +++ src/hg/lib/api.c @@ -1,35 +1,24 @@ /* Utility functions for web API programs */ /* Copyright (C) 2014 The Regents of the University of California * See README in this or parent directory for licensing information. */ #include "common.h" -#include "stdio.h" #include "api.h" void apiOut(char *text, char *jsonp) /* Output content header and text to stdout */ { // It's debatable whether the type should be text/plain, text/javascript or application/javascript; // text/javascript works with all our supported browsers, so we are using that one. puts("Content-Type:text/javascript\n"); if (jsonp) { printf("%s(%s)", jsonp, text); } else { puts(text); } } - -void apiWarnAbortHandler(char *format, va_list args) -/* warnAbort handler that aborts with an HTTP 400 status code. */ -{ -puts("Status: 400\n\n"); -vfprintf(stdout, format, args); -puts("\n"); -exit(-1); -} -