diff --git a/c/dataservice.c b/c/dataservice.c index f143f3a3d..ebe239071 100644 --- a/c/dataservice.c +++ b/c/dataservice.c @@ -328,14 +328,6 @@ int makeHttpDataServiceUrlMask(DataService *dataService, char *urlMaskBuffer, in return 0; } -void setDefaultJSONRESTHeaders(HttpResponse *response) { - setContentType(response, "application/json"); - addStringHeader(response, "Server", "jdmfws"); - addStringHeader(response, "Transfer-Encoding", "chunked"); - addStringHeader(response, "Cache-control", "no-store"); - addStringHeader(response, "Pragma", "no-cache"); -} - /* This program and the accompanying materials are made available under the terms of the Eclipse Public License v2.0 which accompanies diff --git a/c/httpserver.c b/c/httpserver.c index 1d2580498..b76cd8f81 100644 --- a/c/httpserver.c +++ b/c/httpserver.c @@ -3804,6 +3804,13 @@ void respondWithUnixFileNotFound(HttpResponse* response, int jsonMode) { } } +void setDefaultJSONRESTHeaders(HttpResponse *response) { + setContentType(response, "application/json"); + addStringHeader(response, "Server", "jdmfws"); + addStringHeader(response, "Transfer-Encoding", "chunked"); + addStringHeader(response, "Cache-control", "no-store"); + addStringHeader(response, "Pragma", "no-cache"); +} // Response must ALWAYS be finished on return void respondWithJsonError(HttpResponse *response, char *error, int statusCode, char *statusMessage) { diff --git a/h/dataservice.h b/h/dataservice.h index 1da129287..1054c738e 100644 --- a/h/dataservice.h +++ b/h/dataservice.h @@ -83,10 +83,7 @@ void initalizeWebPlugin(WebPlugin *plugin, HttpServer *server); HttpService *makeHttpDataService(DataService *dataService, HttpServer *server); int makeHttpDataServiceUrlMask(DataService *dataService, char *urlMaskBuffer, int urlMaskBufferSize, char *productPrefix); -/** - Convenience function to set headers specific to sending small JSON objects for a REST API - */ -void setDefaultJSONRESTHeaders(HttpResponse *response); + #endif /* __DATASERVICE__ */ diff --git a/h/httpserver.h b/h/httpserver.h index dcf56fb81..50cf10f62 100644 --- a/h/httpserver.h +++ b/h/httpserver.h @@ -524,7 +524,10 @@ int streamTextForFile(Socket *socket, UnixFile *in, int encoding, int makeHTMLForDirectory(HttpResponse *response, char *dirname, char *stem, int includeDotted); int makeJSONForDirectory(HttpResponse *response, char *dirname, int includeDotted); - +/** + Convenience function to set headers specific to sending small JSON objects for a REST API + */ +void setDefaultJSONRESTHeaders(HttpResponse *response); int setHttpParseTrace(int toWhat); int setHttpDispatchTrace(int toWhat);