|
22 | 22 | ping-route)] |
23 | 23 | (get* app "/ping") => (fails-with 500))) |
24 | 24 |
|
25 | | - (fact "response-coersion can ba disabled" |
| 25 | + (fact "response-coercion can be disabled" |
26 | 26 | (let [app (api |
27 | 27 | {:coercion mw/no-response-coercion} |
28 | 28 | ping-route)] |
29 | 29 | (let [[status body] (get* app "/ping")] |
30 | 30 | status => 200 |
31 | 31 | body => {:pong 123}))))) |
32 | 32 |
|
33 | | - (fact "body coersion" |
| 33 | + (fact "body coercion" |
34 | 34 | (let [beer-route (POST* "/beer" [] |
35 | 35 | :body [body {:beers #{(s/enum "ipa" "apa")}}] |
36 | 36 | (ok body))] |
|
42 | 42 | status => 200 |
43 | 43 | body => {:beers ["ipa" "apa"]}))) |
44 | 44 |
|
45 | | - (fact "body-coersion can ba disabled" |
| 45 | + (fact "body-coercion can be disabled" |
46 | 46 | (let [no-body-coercion (constantly (dissoc mw/default-coercion-matchers :body)) |
47 | 47 | app (api |
48 | 48 | {:coercion no-body-coercion} |
|
51 | 51 | status => 200 |
52 | 52 | body => {:beers ["ipa" "apa" "ipa"]}))) |
53 | 53 |
|
54 | | - (fact "body-coersion can ba changed" |
| 54 | + (fact "body-coercion can be changed" |
55 | 55 | (let [nop-body-coercion (constantly (assoc mw/default-coercion-matchers :body (constantly nil))) |
56 | 56 | app (api |
57 | 57 | {:coercion nop-body-coercion} |
58 | 58 | beer-route)] |
59 | 59 | (post* app "/beer" (json {:beers ["ipa" "apa" "ipa"]})) => (fails-with 400))))) |
60 | 60 |
|
61 | | - (fact "query coersion" |
| 61 | + (fact "query coercion" |
62 | 62 | (let [query-route (GET* "/query" [] |
63 | 63 | :query-params [i :- s/Int] |
64 | 64 | (ok {:i i}))] |
|
70 | 70 | status => 200 |
71 | 71 | body => {:i 10}))) |
72 | 72 |
|
73 | | - (fact "query-coersion can ba disabled" |
| 73 | + (fact "query-coercion can be disabled" |
74 | 74 | (let [no-query-coercion (constantly (dissoc mw/default-coercion-matchers :string)) |
75 | 75 | app (api |
76 | 76 | {:coercion no-query-coercion} |
|
79 | 79 | status => 200 |
80 | 80 | body => {:i "10"}))) |
81 | 81 |
|
82 | | - (fact "query-coersion can ba changed" |
| 82 | + (fact "query-coercion can be changed" |
83 | 83 | (let [nop-query-coercion (constantly (assoc mw/default-coercion-matchers :string (constantly nil))) |
84 | 84 | app (api |
85 | 85 | {:coercion nop-query-coercion} |
86 | 86 | query-route)] |
87 | 87 | (get* app "/query" {:i 10}) => (fails-with 400))))) |
88 | 88 |
|
89 | | - (fact "route-spesific coercion" |
| 89 | + (fact "route-specific coercion" |
90 | 90 | (let [app (api |
91 | 91 | (GET* "/default" [] |
92 | 92 | :query-params [i :- s/Int] |
|
0 commit comments