|
188 | 188 | "Content-Type: text/plain\r\n\r\n"
|
189 | 189 | "foobar\r\n"
|
190 | 190 | "--XXXX--")
|
191 |
| - headers {"content-type" (str "multipart/form-data; boundary=XXXX")} |
192 |
| - handler (constantly {:status 200, :headers {}, :body "OK"})] |
| 191 | + headers {"content-type" (str "multipart/form-data; boundary=XXXX")} |
| 192 | + handler (constantly {:status 200, :headers {}, :body "OK"}) |
| 193 | + handler-async (fn [_ respond _] |
| 194 | + (respond {:status 200, :headers {}, :body "OK"}))] |
193 | 195 | (is (thrown? org.apache.commons.fileupload.FileUploadBase$FileUploadIOException
|
194 | 196 | (multipart-params-request
|
195 | 197 | {:headers headers, :body (string-input-stream form-body)}
|
|
209 | 211 | (is (= 413 (:status response))))
|
210 | 212 | (let [response ((wrap-multipart-params handler {:max-file-count 2})
|
211 | 213 | {:headers headers, :body (string-input-stream form-body)})]
|
212 |
| - (is (= 200 (:status response)))))) |
| 214 | + (is (= 200 (:status response)))) |
| 215 | + (let [response (promise) |
| 216 | + error (promise)] |
| 217 | + ((wrap-multipart-params handler-async {:max-file-size 6}) |
| 218 | + {:headers headers, :body (string-input-stream form-body)} |
| 219 | + response |
| 220 | + error) |
| 221 | + (is (= 413 (:status @response))) |
| 222 | + (is (not (realized? error)))) |
| 223 | + (let [response (promise) |
| 224 | + error (promise)] |
| 225 | + ((wrap-multipart-params handler-async {:max-file-count 1}) |
| 226 | + {:headers headers, :body (string-input-stream form-body)} |
| 227 | + response |
| 228 | + error) |
| 229 | + (is (= 413 (:status @response))) |
| 230 | + (is (not (realized? error)))))) |
0 commit comments