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