Browse Source

Fix headers for Clojure/macchiato and Erlang/mochiweb (#3646)

Nate 7 years ago
parent
commit
b92856147c

+ 1 - 1
frameworks/Clojure/macchiato/src/hello/routes.cljs

@@ -28,7 +28,7 @@
 
 
 (defn plaintext [_ res _]
 (defn plaintext [_ res _]
   (-> (r/ok "Hello, World!")
   (-> (r/ok "Hello, World!")
-      (r/content-type "text/html")
+      (r/content-type "text/plain")
       (res)))
       (res)))
 
 
 (defn single-query-test [req res raise]
 (defn single-query-test [req res raise]

+ 4 - 1
frameworks/Erlang/mochiweb/src/web_handler.erl

@@ -33,7 +33,7 @@ handle('GET', ["updates"], Req) ->
     json(Req, erl_bench:update_randoms_json(Queries));
     json(Req, erl_bench:update_randoms_json(Queries));
 
 
 handle('GET', ["fortunes"], Req) ->
 handle('GET', ["fortunes"], Req) ->
-    html(Req, erl_bench:fortunes_html());
+    fortune(Req, erl_bench:fortunes_html());
 
 
 handle(_Method, _Path, Req) ->
 handle(_Method, _Path, Req) ->
     Req:respond({404, [{"Content-Type", "text/plain"}], "Not Found"}).
     Req:respond({404, [{"Content-Type", "text/plain"}], "Not Found"}).
@@ -49,6 +49,9 @@ plain(Req, Text) ->
 html(Req, Html) ->
 html(Req, Html) ->
     Req:ok({"text/html", Html}).
     Req:ok({"text/html", Html}).
 
 
+fortune(Req, Html) ->
+    Req:ok({"text/html;charset=UTF-8", Html}).
+
 queries(Req) ->
 queries(Req) ->
     Params = Req:parse_qs(),
     Params = Req:parse_qs(),
     Queries = (catch list_to_integer(proplists:get_value("queries", Params, "1"))),
     Queries = (catch list_to_integer(proplists:get_value("queries", Params, "1"))),