Skip to content

Commit 507dbc1

Browse files
committed
Expand wrap-validation schema to allow string values for :request-method
1 parent bb3a1f1 commit 507dbc1

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

CHANGES.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### Unreleased
2+
3+
* Loosen `wrap-validation` validation to support strings in :request-method. (See release in 0.6.2 for more information).
4+
15
### 0.8.3
26

37
* Bump Netty to 4.1.118.Final (CVE-2025-24970 and bug-fixes)
@@ -46,7 +50,7 @@ Manifold contributions by Jacob Maine and Ferdinand Beyer
4650
* Bump Manifold to 0.4.2 to fix Promesa print-method hierarchy bug
4751
* Bump Dirigiste to 1.0.4
4852
* Log SSL handshake completion at debug level instead of info level
49-
53+
5054
Contributions by Matthew Davidson and Eric Dvorsak
5155

5256
### 0.7.0
@@ -77,11 +81,14 @@ Contributions by Matthew Davidson and Stefan van den Oord.
7781

7882
* Fix backwards-compatibility for transport options
7983
* Bump Netty to 4.1.89.Final, and io_uring to 0.0.18.Final
80-
* Add `wrap-validation` middleware to validate Ring maps
8184
* Bump deps and example deps
8285
* Upgrade CircleCI instance size
8386
* Switch to pedantic deps for CircleCI
8487

88+
### Breaking changes
89+
90+
* Add `wrap-validation` middleware to validate Ring maps [#679](https://github.com/clj-commons/aleph/pull/679). While the Ring spec has always [required](https://github.com/ring-clojure/ring/blob/master/SPEC.md#request-method) a keyword value for `:request-method` (e.g. `:get`), previously, Aleph would also accept string methods (e.g. `"GET"`). This means that `wrap-validation` may cause HTTP requests to fail on previously valid input. This will be fixed in the release after 0.8.3.
91+
8592
Contributions by Arnaud Geiser, Ertuğrul Çetin, Jeroen van Dijk, David Ongaro,
8693
Matthew Davidson, and Moritz Heidkamp.
8794

src/aleph/http/schema.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
(def uri [:maybe :string])
88
(def query-string [:maybe :string])
99
(def scheme [:enum :http :https])
10-
(def request-method :keyword)
10+
(def request-method [:or :string :keyword])
1111
(def content-type [:maybe [:or :string :keyword]])
1212
(def content-length [:maybe :int])
1313
(def character-encoding [:maybe :string])

test/aleph/http/client_middleware_test.clj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@
183183
(doseq [req (mg/sample schema/ring-request)]
184184
(is (middleware/wrap-validation req)))
185185

186+
(testing "Request methods can be strings"
187+
(is (middleware/wrap-validation {:remote-addr "localhost"
188+
:server-name "computer"
189+
:scheme :http
190+
:request-method "GET"})))
191+
186192
(is (thrown-with-msg?
187193
IllegalArgumentException
188194
#"Invalid spec.*:in \[:request-method\].*:type :malli.core/missing-key"

0 commit comments

Comments
 (0)