Browse Source

D/Hunt: Minor improvements (#4258)

* Remove binary file

* json handling improved

* Rename to hunt-minihttp
Heromyth 6 years ago
parent
commit
8d9d64931f

+ 1 - 1
frameworks/D/hunt/README.md

@@ -4,7 +4,7 @@ This is the Hunt portion of a [benchmarking test suite](../) comparing a variety
 
 
 ## Requirements
-* Dlang > 2.083
+* Dlang > 2.077
 
 ## Test URLs
 

+ 3 - 2
frameworks/D/hunt/dub.json

@@ -1,5 +1,5 @@
 {
-	"name": "hunt-benchmark",
+	"name": "hunt-minihttp",
 	"targetType": "executable",
 	"authors": [
 		"Putao"
@@ -10,6 +10,7 @@
 	"libs-posix": [ "http_parser" ],
 	"lflags-posix": ["-Lhttp-parser/"],
 	"dependencies": {
-		"hunt": "~>1.0.0-rc.5"
+		"hunt": "~>1.0.0-rc.5",
+		"std_data_json": "~>0.18.2"
 	}
 }

BIN
frameworks/D/hunt/hunt-benchmark


+ 1 - 1
frameworks/D/hunt/hunt-ldc.dockerfile

@@ -12,4 +12,4 @@ RUN git clone https://github.com/nodejs/http-parser.git && \
 RUN dub upgrade --verbose
 RUN dub build -f --arch=x86_64 --build=release --compiler=ldc2
 
-CMD ["./hunt-benchmark"]
+CMD ["./hunt-minihttp"]

+ 1 - 1
frameworks/D/hunt/hunt.dockerfile

@@ -12,4 +12,4 @@ RUN git clone https://github.com/nodejs/http-parser.git && \
 RUN dub upgrade --verbose
 RUN dub build -f --arch=x86_64 --build=release
 
-CMD ["./hunt-benchmark"]
+CMD ["./hunt-minihttp"]

+ 3 - 5
frameworks/D/hunt/source/DemoProcessor.d

@@ -2,7 +2,7 @@ module DemoProcessor;
 
 import hunt.io;
 import http.Processor;
-import std.json;
+import stdx.data.json;
 
 class DemoProcessor : HttpProcessor {
     this(TcpStream client) {
@@ -16,10 +16,8 @@ class DemoProcessor : HttpProcessor {
             break;
 
         case "/json":
-            JSONValue js;
-            js["message"] = "Hello, World!";
-            string content = js.toString();
-            respondWith(content, 200, HttpHeader("Content-Type", "application/json"));
+            JSONValue js = JSONValue(["message" : JSONValue("Hello, World!")]);
+            respondWith(js.toJSON(), 200, HttpHeader("Content-Type", "application/json"));
             break;
 
         default: