Skip to content

Commit 934cf09

Browse files
committed
Fix conf-rest
1 parent 94cd3d8 commit 934cf09

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

packages/conf-rest/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lemonldap-ng/conf-rest",
3-
"version": "0.7.0",
3+
"version": "0.7.1",
44
"description": "lemonldap-ng class for REST configuration access",
55
"main": "./lib/index.js",
66
"module": "./lib/index.mjs",

packages/conf-rest/src/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ test("lastCfg", (done) => {
2222

2323
test("load", (done) => {
2424
server.get(/^.*$/).mockImplementationOnce((ctx) => {
25-
expect(ctx.originalUrl).toEqual("/1?full=1");
25+
expect(ctx.originalUrl).toMatch(/^\/+1\?full=1$/);
2626
ctx.status = 200;
2727
ctx.body = '{"cfgNum":1,"f1":"field 1"}';
2828
});

packages/conf-rest/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class RESTConf implements Conf_Accessor {
1919
if (!args.baseUrl.match(/(https?):\/\/([^/:]+)(?::(\d+))?(.*)/))
2020
throw new Error(`Bad URL ${args.baseUrl}`);
2121

22-
this.baseUrl = args.baseUrl.split('/',1)[0];
22+
this.baseUrl = args.baseUrl.replace(/\/+$/, "");
2323
if (args.user) {
2424
this.user = args.user;
2525
if (!args.password) throw new Error("password required");

0 commit comments

Comments
 (0)