mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-26 18:31:54 +00:00
19 lines
403 B
TypeScript
19 lines
403 B
TypeScript
export class Origin {
|
|
constructor(readonly protocol: string, readonly host: string) {}
|
|
|
|
withAuth(
|
|
origin?:
|
|
| {
|
|
password: string
|
|
username: string
|
|
}
|
|
| null
|
|
| undefined,
|
|
) {
|
|
// prettier-ignore
|
|
const urlAuth = !!(origin) ? `${origin.username}:${origin.password}@` :
|
|
'';
|
|
return `${this.protocol}://${urlAuth}${this.host}`
|
|
}
|
|
}
|