File tree Expand file tree Collapse file tree 1 file changed +26
-14
lines changed Expand file tree Collapse file tree 1 file changed +26
-14
lines changed Original file line number Diff line number Diff line change 328
328
(is (= characters body'))))))
329
329
330
330
(deftest test-redirect
331
- (with-both-handlers basic-handler
332
- (is (= " ok"
333
- (-> @(http-get (str " http://localhost:" port " /redirect?count=10" ))
334
- :body
335
- bs/to-string)))
336
- (is (= " redirected!"
337
- (-> @(http-get (str " http://localhost:" port " /redirect?count=25" ))
338
- :body
339
- bs/to-string)))
340
- (is (= " ok"
341
- (-> @(http-get (str " http://localhost:" port " /redirect?count=25" )
342
- {:max-redirects 30 })
343
- :body
344
- bs/to-string)))))
331
+ (testing " basic redirecting"
332
+ (with-both-handlers basic-handler
333
+ (is (= " ok"
334
+ (-> @(http-get (str " http://localhost:" port " /redirect?count=10" ))
335
+ :body
336
+ bs/to-string)))
337
+ (is (= " redirected!"
338
+ (-> @(http-get (str " http://localhost:" port " /redirect?count=25" ))
339
+ :body
340
+ bs/to-string)))
341
+ (is (= " ok"
342
+ (-> @(http-get (str " http://localhost:" port " /redirect?count=25" )
343
+ {:max-redirects 30 })
344
+ :body
345
+ bs/to-string)))))
346
+
347
+ (testing " works with :method as well as :request-method"
348
+ (with-handler
349
+ (fn [{:keys [uri]}]
350
+ (case uri
351
+ " /200" {:status 200 }
352
+ " /301" {:status 301
353
+ :headers {" Location" " /200" }}))
354
+ (is (= 200 (:status @(http/request {:method :get
355
+ :url (str " http://localhost:" port " /301" )
356
+ :follow-redirects? true })))))))
345
357
346
358
(deftest test-middleware
347
359
(with-both-handlers basic-handler
You can’t perform that action at this time.
0 commit comments