File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change 1074
1074
(Thread/sleep 5 )
1075
1075
(s/put! s (encode-http-object response))))
1076
1076
1077
- (defmacro with-tcp-server [handler & body]
1078
- `(with-server (tcp/start-server ~handler {:port port
1079
- :shutdown-timeout 0 })
1080
- ~@body))
1081
-
1082
1077
(defmacro with-tcp-response [response & body]
1083
- `(with-tcp-server (tcp-handler ~response) ~@body))
1078
+ `(with-server (tcp/start-server (tcp-handler ~response) {:port port
1079
+ :shutdown-timeout 0 })
1080
+ ~@body))
1084
1081
1085
1082
(defmacro with-tcp-request-handler [handler options request & body]
1086
1083
`(with-server (http/start-server ~handler (merge http-server-options ~options))
1446
1443
(deftest test-in-flight-request-cancellation
1447
1444
(let [conn-established (promise )
1448
1445
conn-closed (promise )]
1449
- (with-tcp-server (fn [s _]
1450
- (deliver conn-established true )
1451
- ; ; Required for the client close to be detected
1452
- (s/consume identity s)
1453
- (s/on-closed s (fn []
1454
- (deliver conn-closed true ))))
1446
+ (with-raw-handler (fn [req]
1447
+ (deliver conn-established true )
1448
+ (s/on-closed (:body req)
1449
+ (fn []
1450
+ (deliver conn-closed true ))))
1455
1451
(let [rsp (http-get " /" )]
1456
1452
(is (= true (deref conn-established 1000 :timeout )))
1457
1453
(http/cancel-request! rsp)
You can’t perform that action at this time.
0 commit comments