File tree Expand file tree Collapse file tree 2 files changed +6
-13
lines changed Expand file tree Collapse file tree 2 files changed +6
-13
lines changed Original file line number Diff line number Diff line change 213
213
" exit" (on-exit state params )
214
214
[:noresponse state ])))
215
215
216
- (defn line-ending []
217
- (case (os/which )
218
- :windows " \r\n\r\n "
219
- " \n\n " ))
220
-
221
- (defn read-offset []
216
+ (def line-ending " \r\n\r\n " )
217
+ (def read-offset
222
218
(case (os/which )
223
219
:windows 1
224
220
2 ))
225
221
226
222
(defn write-response [file response ]
227
223
# Write headers
228
- (file/write file (string " Content-Length: " (length response ) ( line-ending ) ))
224
+ (file/write file (string " Content-Length: " (length response ) line-ending ))
229
225
230
226
# Write response
231
227
(file/write file response )
235
231
236
232
(defn read-message []
237
233
(let [input (file/read stdin :line )
238
- content-length (+ (parse-content-length input ) ( read-offset ) )
234
+ content-length (+ (parse-content-length input ) read-offset )
239
235
input (file/read stdin content-length )]
240
236
(json/decode input )))
241
237
Original file line number Diff line number Diff line change 2
2
3
3
(use judge )
4
4
5
- (defn line-ending []
6
- (case (os/which )
7
- :windows " \r\n\r\n "
8
- " \n\n " ))
5
+ (def line-ending " \r\n\r\n " )
9
6
10
7
(defn write-output [handle response ]
11
8
# Write headers
12
- (:write handle (string " Content-Length: " (length response ) ( line-ending ) ))
9
+ (:write handle (string " Content-Length: " (length response ) line-ending ))
13
10
14
11
# Write response
15
12
(:write handle (string response (if (string/has-suffix? " \n " response ) " " " \n " )))
You can’t perform that action at this time.
0 commit comments