Fixed static if
This commit is contained in:
parent
98d379925e
commit
003a51a177
|
@ -3,9 +3,9 @@
|
|||
"versions": {
|
||||
"asdf": "0.7.17",
|
||||
"dxml": "0.4.4",
|
||||
"handy-http-primitives": "1.6.0",
|
||||
"mir-algorithm": "3.22.3",
|
||||
"mir-core": "1.7.1",
|
||||
"handy-http-primitives": "1.8.0",
|
||||
"mir-algorithm": "3.22.4",
|
||||
"mir-core": "1.7.3",
|
||||
"silly": "1.1.1",
|
||||
"streams": "3.6.0"
|
||||
}
|
||||
|
|
|
@ -56,8 +56,13 @@ void writeJsonBody(T)(ref ServerHttpResponse response, in T bodyContent) {
|
|||
import std.json;
|
||||
import asdf : serializeToJson, SerdeException;
|
||||
try {
|
||||
static if (isArray!T && bodyContent.length == 0) {
|
||||
string responseBody = "[]";
|
||||
static if (isArray!T) {
|
||||
string responseBody;
|
||||
if (bodyContent.length == 0) {
|
||||
responseBody = "[]";
|
||||
} else {
|
||||
responseBody = serializeToJson(bodyContent);
|
||||
}
|
||||
} else static if (is(T == JSONValue)) {
|
||||
string responseBody = bodyContent.toString();
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue