|
330 | 330 | {:status 404}))] |
331 | 331 | (let [info (oauth/oauth-info "https://example.com/mcp" nil)] |
332 | 332 | (is (= oauth/eca-client-id (:client-id info))))))) |
| 333 | + |
| 334 | +(deftest url-without-query-test |
| 335 | + (testing "strips query string" |
| 336 | + (is (= "https://mcp.example.com/v1" |
| 337 | + (oauth/url-without-query "https://mcp.example.com/v1?token=x&debug=true")))) |
| 338 | + |
| 339 | + (testing "strips fragment" |
| 340 | + (is (= "https://mcp.example.com/v1" |
| 341 | + (oauth/url-without-query "https://mcp.example.com/v1#section")))) |
| 342 | + |
| 343 | + (testing "strips both query and fragment" |
| 344 | + (is (= "https://mcp.example.com/v1" |
| 345 | + (oauth/url-without-query "https://mcp.example.com/v1?a=1#frag")))) |
| 346 | + |
| 347 | + (testing "returns URL unchanged when no query or fragment" |
| 348 | + (is (= "https://mcp.example.com/v1/mcp" |
| 349 | + (oauth/url-without-query "https://mcp.example.com/v1/mcp")))) |
| 350 | + |
| 351 | + (testing "preserves port" |
| 352 | + (is (= "https://mcp.example.com:8443/v1" |
| 353 | + (oauth/url-without-query "https://mcp.example.com:8443/v1?key=val")))) |
| 354 | + |
| 355 | + (testing "different paths are distinct" |
| 356 | + (is (not= (oauth/url-without-query "https://mcp.example.com/v1") |
| 357 | + (oauth/url-without-query "https://mcp.example.com/v2")))) |
| 358 | + |
| 359 | + (testing "different hosts are distinct" |
| 360 | + (is (not= (oauth/url-without-query "https://a.example.com/v1") |
| 361 | + (oauth/url-without-query "https://b.example.com/v1")))) |
| 362 | + |
| 363 | + (testing "returns nil for nil input" |
| 364 | + (is (nil? (oauth/url-without-query nil))))) |
0 commit comments