1 ;;; post-echo.el --- echo back posted message using Emacs Web Server
2 ;; Copyright (C) 2014 Free Software Foundation, Inc.
7 (with-slots (process headers) request
8 (let ((message (cdr (assoc "message" headers))))
9 (ws-response-header process 200 '("Content-type" . "text/plain"))
10 (process-send-string process
12 (format "you said %S\n" (cdr (assoc 'content message)))
13 "This is a POST request, but it has no \"message\".\n"))))))
16 (with-slots (process) request
17 (ws-response-header process 200 '("Content-type" . "text/plain"))
18 (process-send-string process
19 "This is a GET request not a POST request.\n")))))