url method
Constructs a full URL by combining a base URL with a subpath and optional query parameters.
subPath
- The path to be appended to the base URL.
params
- Optional query parameters to be included in the URL.
Returns a String containing the full URL.
Implementation
String url(String subPath, {Map<String, String>? params}) {
var pathRequest = _rq.requestedUri.origin;
var uri = Uri.parse(pathRequest);
uri = uri.resolve(subPath);
if (params != null) {
uri = uri.replace(queryParameters: params);
}
/// When the request is HTTPS, the URL should be HTTPS as well.
uri = uri.replace(scheme: uri.scheme);
var url = uri.toString();
return url;
}