rouzer 1.0.0-beta.5 → 1.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +3 -1
- package/package.json +1 -1
package/dist/client/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { shake } from '../common.js';
|
|
2
2
|
export function createClient(config) {
|
|
3
|
+
const baseURL = config.baseURL.replace(/\/$/, '');
|
|
3
4
|
return {
|
|
4
5
|
config,
|
|
5
6
|
request({ pathPattern, method, args: { path, query, body, headers }, route, }) {
|
|
6
7
|
if (route.path) {
|
|
7
8
|
path = route.path.parse(path);
|
|
8
9
|
}
|
|
9
|
-
const url = new URL(
|
|
10
|
+
const url = new URL(baseURL);
|
|
11
|
+
url.pathname += pathPattern.href(path);
|
|
10
12
|
if (route.query) {
|
|
11
13
|
query = route.query.parse(query ?? {});
|
|
12
14
|
url.search = new URLSearchParams(query).toString();
|