Commit bdcaa736 authored by Kirill Smelkov's avatar Kirill Smelkov

go & ruby: Add trailing newline to response

Just for convenience. Before (e.g. for go):

    kirr@teco:~$ curl http://[::1]:7778
    Hello world at `/`  ; Thu Jun  9 11:09:49 2016  (go)kirr@teco:~$

After:

    kirr@teco:~$ curl http://[::1]:7778
    Hello world at `/`  ; Thu Jun  9 11:10:36 2016  (go)
    kirr@teco:~$

Python version already emits trailing newline, because it uses `print ...`
without trailing ",".

/reviewed-by TrustMe
parent c9d0758f
......@@ -29,7 +29,7 @@ func logit(handler http.Handler) http.Handler {
var name string
func webhello(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello %s at `%s` ; %s (go)", name,
fmt.Fprintf(w, "Hello %s at `%s` ; %s (go)\n", name,
r.URL.Path, asctime())
}
......
......@@ -41,7 +41,7 @@ def main
httpd.mount_proc '/' do |req, resp|
name = args.argv_extra.join(' ')
name = 'world' if name.empty?
resp.body = "Hello #{name} at `#{req.path}` ; #{Time.now.asctime} (ruby)"
resp.body = "Hello #{name} at `#{req.path}` ; #{Time.now.asctime} (ruby)\n"
end
httpd.start
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment