         (is (= 200 (:status resp)))
         (is (= "text/html" (help/get-content-type resp)))))
 
+    (testing "request with valid page returns data"
+      (let [resp (do-search-with-page "" "test" "1" {:throw-exceptions false})]
+        (is (= 200 (:status resp)))
+        (is (= "text/html" (help/get-content-type resp)))))
+
+    (testing "request with invalid page returns error"
+      (let [resp (do-search-with-page "" "test" "a" {:throw-exceptions false})]
+        (is (= 400 (:status resp)))
+        (is (= "text/html" (help/get-content-type resp)))))
+
     (testing "unknown format request returns html" ;; debatable behavior
       (let [resp (do-search :ham "test")]
         (is (= 200 (:status resp)))

        query
        (name fmt))
    (client/get opts)))

(deftest search-test
  (let [base-data {:description "foo" :version "1.0"}

        (is (= 2 (:count result)))
        (is (= search-data (:results result)))))

    (testing "json request with invalid page returns error"
      (let [resp (do-search-with-page :json "test" "a" {:throw-exceptions false})
            result (json/parse-string (:body resp) true)]
        (prn resp)
        (is (= 400 (:status resp)))
        (is (= "application/json" (help/get-content-type resp)))
        (is (not (nil? (:error result))))
        (is (not (nil? (:error-id result))))))

    (testing "invalid query syntax returns error"
      (let [resp (do-search :json "test+AND" {:throw-exceptions false})
            result (json/parse-string (:body resp) true)]
