Files
Pdv-Pos/pdv/lib/data/datasources/remote/odoo_api_uri_builder.dart

16 lines
473 B
Dart

class OdooApiUriBuilder {
OdooApiUriBuilder._();
static Uri endpoint(Uri serverUri, String endpointPath) {
final basePath = serverUri.path.replaceFirst(RegExp(r'/+$'), '');
final normalizedEndpoint =
endpointPath.startsWith('/') ? endpointPath : '/$endpointPath';
return Uri(
scheme: serverUri.scheme,
host: serverUri.host,
port: serverUri.hasPort ? serverUri.port : null,
path: '$basePath$normalizedEndpoint',
);
}
}