mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-09 15:07:55 -05:00
fix(base-url): use getBaseUrl helper in copilot revert state endpoint (#1706)
* revert base url * fix tests" ;
This commit is contained in:
committed by
GitHub
parent
89eb1849d0
commit
ca1156a6c2
@@ -23,6 +23,13 @@ describe('Copilot Checkpoints Revert API Route', () => {
|
||||
setupCommonApiMocks()
|
||||
mockCryptoUuid()
|
||||
|
||||
// Mock getBaseUrl to return localhost for tests
|
||||
vi.doMock('@/lib/urls/utils', () => ({
|
||||
getBaseUrl: vi.fn(() => 'http://localhost:3000'),
|
||||
getBaseDomain: vi.fn(() => 'localhost:3000'),
|
||||
getEmailDomain: vi.fn(() => 'localhost:3000'),
|
||||
}))
|
||||
|
||||
mockSelect.mockReturnValue({ from: mockFrom })
|
||||
mockFrom.mockReturnValue({ where: mockWhere })
|
||||
mockWhere.mockReturnValue({ then: mockThen })
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
} from '@/lib/copilot/auth'
|
||||
import { createLogger } from '@/lib/logs/console/logger'
|
||||
import { validateUUID } from '@/lib/security/input-validation'
|
||||
import { getBaseUrl } from '@/lib/urls/utils'
|
||||
|
||||
const logger = createLogger('CheckpointRevertAPI')
|
||||
|
||||
@@ -93,7 +94,7 @@ export async function POST(request: NextRequest) {
|
||||
}
|
||||
|
||||
const stateResponse = await fetch(
|
||||
`${request.nextUrl.origin}/api/workflows/${checkpoint.workflowId}/state`,
|
||||
`${getBaseUrl()}/api/workflows/${checkpoint.workflowId}/state`,
|
||||
{
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user