Skip to content
1 change: 1 addition & 0 deletions src/errors/sdk-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class LilySdkError extends Error {
this.code = options.code;
this.statusCode = options.statusCode;
this.details = options.details;
this.headers = options.headers;
this.request = options.request;
this.headers = options.headers;
}
Expand Down
2 changes: 1 addition & 1 deletion src/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AgentClient } from './clients/agent-client';
undefinedimport { AgentClient } from './clients/agent-client';
import { IdentityClient } from './clients/identity-client';
import { PaymentClient } from './clients/payment-client';
import { SystemClient } from './clients/system-client';
Expand Down
20 changes: 20 additions & 0 deletions tests/canonical-url.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { describe, it, expect } from 'vitest';
import { LilySdk, DEFAULT_API_URL } from '../src/sdk';

describe('DEFAULT_API_URL canonical constant (issue #408)', () => {
it('is exported and equals the canonical URL', () => {
expect(DEFAULT_API_URL).toBe('https://api.lilyprotocol.com');
});

it('LilySdk.create() without options falls back to DEFAULT_API_URL when no env var is set', () => {
const originalEnv = process.env.LILY_API_URL;
delete process.env.LILY_API_URL;
try {
const sdk = LilySdk.create();
expect(sdk.config.baseUrl.toString()).toBe('https://api.lilyprotocol.com/');
} finally {
if (originalEnv !== undefined) process.env.LILY_API_URL = originalEnv;
else delete process.env.LILY_API_URL;
}
});
});