mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
net.urllib: add a URL.debug() method, returning the values of all the URL's fields
This commit is contained in:
parent
e2cf403ca1
commit
3b420a8d7f
@ -303,13 +303,9 @@ fn escape(s string, mode EncodingMode) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// A URL represents a parsed URL (technically, a URI reference).
|
// A URL represents a parsed URL (technically, a URI reference).
|
||||||
//
|
|
||||||
// The general form represented is:
|
// The general form represented is:
|
||||||
//
|
|
||||||
// [scheme:][//[userinfo@]host][/]path[?query][#fragment]
|
// [scheme:][//[userinfo@]host][/]path[?query][#fragment]
|
||||||
//
|
|
||||||
// URLs that do not start with a slash after the scheme are interpreted as:
|
// URLs that do not start with a slash after the scheme are interpreted as:
|
||||||
//
|
|
||||||
// scheme:opaque[?query][#fragment]
|
// scheme:opaque[?query][#fragment]
|
||||||
//
|
//
|
||||||
// Note that the path field is stored in decoded form: /%47%6f%2f becomes /Go/.
|
// Note that the path field is stored in decoded form: /%47%6f%2f becomes /Go/.
|
||||||
@ -333,6 +329,11 @@ pub mut:
|
|||||||
fragment string // fragment for references, without '#'
|
fragment string // fragment for references, without '#'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// debug returns a string representation of *ALL* the fields of the given URL
|
||||||
|
pub fn (url &URL) debug() string {
|
||||||
|
return 'URL{\n scheme: $url.scheme\n opaque: $url.opaque\n user: $url.user\n host: $url.host\n path: $url.path\n raw_path: $url.raw_path\n force_query: $url.force_query\n raw_query: $url.raw_query\n fragment: $url.fragment\n}'
|
||||||
|
}
|
||||||
|
|
||||||
// user returns a Userinfo containing the provided username
|
// user returns a Userinfo containing the provided username
|
||||||
// and no password set.
|
// and no password set.
|
||||||
pub fn user(username string) &Userinfo {
|
pub fn user(username string) &Userinfo {
|
||||||
|
Loading…
Reference in New Issue
Block a user