-
Notifications
You must be signed in to change notification settings - Fork 328
Description
Hi,
I cannot understand the parse and safeApply functions of Uri
The following unit tests are OK.
import sttp.model.Uri
// scheme:[//[user:password@]host[:port]]path[?query][#fragment]
assert(Uri.safeApply("http://example.com/path?query=123#frag").isRight)
assert(Uri.safeApply("mailto:[email protected]").isRight)
assert(Uri.safeApply("ftp://user:[email protected]:21/files").isRight)
But the following unit tests are KO : do I use correctly the API to validate an uri ?
// 1. Missing scheme
assert(Uri.safeApply("example.com/path").isLeft)
// 2. Invalid characters (unescaped)
assert(Uri.safeApply("http://example.com/space here").isLeft)
// 3. Invalid port number
assert(Uri.safeApply("http://example.com:999999/path").isLeft)
// 4. Malformed IPv6 address
assert(Uri.safeApply("http://[2001:db8::12345]/path").isLeft)
regards,
OD