File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 11local curl_cli = require (" rest-nvim.client.curl.cli" )
2+ local logger = require (" rest-nvim.logger" )
23
34local COMPATIBLE_METHODS = {
45 " OPTIONS" ,
@@ -20,8 +21,9 @@ local client = {
2021 request = curl_cli .request ,
2122 available = function (req )
2223 local method_ok = vim .list_contains (COMPATIBLE_METHODS , req .method )
23- local scheme = req .url :match (" ^(. +)://" )
24+ local scheme = req .url :match (" ^([^:] +)://" )
2425 local scheme_ok = (not scheme ) or scheme == " http" or scheme == " https"
26+ logger .debug ((" scheme %s not supported for curl_cli client" ):format (scheme or " <nil>" ))
2527 return method_ok and scheme_ok
2628 end ,
2729}
Original file line number Diff line number Diff line change 1+ --- @module ' luassert'
2+
3+ local clients = require (" rest-nvim.client" )
4+
5+ describe (" request clients" , function ()
6+ it (" get_available_clients" , function ()
7+ local req = {
8+ method = " GET" ,
9+ url = " https://duckduckgo.com?q=https://duckduckgo.com" ,
10+ headers = {},
11+ cookies = {},
12+ handlers = {},
13+ }
14+ local available_clients = clients .get_available_clients (req )
15+ assert .same (1 , # available_clients )
16+ end )
17+ end )
You can’t perform that action at this time.
0 commit comments