File tree Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Original file line number Diff line number Diff line change 5
5
:description " CL-protobuf Hello World Server"
6
6
:long-description " CL-protobuf Hello World Server"
7
7
:defsystem-depends-on (:cl-protobufs )
8
- :depends-on (:hunchentoot :flexi-streams
9
- :cl-base64 :protobuf-utilities )
8
+ :depends-on (:hunchentoot )
10
9
:components
11
10
((:module " src"
12
11
:serial t
Original file line number Diff line number Diff line change 4
4
(:export # :start-server
5
5
# :stop-server)
6
6
(:local-nicknames
7
- (# :hwp # :cl-protobufs.hello-world)
8
- (# :pu # :protobuf-utilities)))
7
+ (# :hwp # :cl-protobufs.hello-world)))
9
8
10
9
(in-package :hello-world-server )
11
10
17
16
18
17
(setf *acceptor* nil )
19
18
20
- (define-easy-handler (hello-world :uri " /hello" )
21
- ((request :parameter-type ' string))
22
- (pu :with-deserialized-protos-serializing-return ((request . hwp :request))
23
- (hwp :make-response
24
- :response
25
- (if (hwp :request.has-name request)
26
- (format nil " Hello ~a " (hwp :request.name request))
27
- " Hello" ))))
19
+ (define-easy-handler (hello-world :uri " /hello" ) ()
20
+ (setf (hunchentoot :content-type*) " application/octet-stream" )
21
+ (let* ((post-request (raw-post-data))
22
+ (request (if post-request
23
+ (cl-protobufs :deserialize-from-bytes
24
+ ' hwp:request post-request)
25
+ (hwp :make-request)))
26
+ (response (hwp :make-response
27
+ :response
28
+ (if (hwp :request.has-name request)
29
+ (format nil " Hello ~a " (hwp :request.name request))
30
+ " Hello" ))))
31
+ (cl-protobufs :serialize-to-bytes response)))
28
32
29
33
(defun stop-server ()
30
34
(when *acceptor*
You can’t perform that action at this time.
0 commit comments