@@ -5,6 +5,7 @@ import { formatAxiosError } from "../../lib/error.js";
55import { projectIdentifierToId } from "../testmanagement-utils/TCG-utils/api.js" ;
66import { getBrowserStackAuth } from "../../lib/get-auth.js" ;
77import { BrowserStackConfig } from "../../lib/types.js" ;
8+ import { getTMBaseURL } from "../../lib/tm-base-url.js" ;
89
910// Schema for combined project/folder creation
1011export const CreateProjFoldSchema = z . object ( {
@@ -65,8 +66,9 @@ export async function createProjectOrFolder(
6566 try {
6667 const authString = getBrowserStackAuth ( config ) ;
6768 const [ username , password ] = authString . split ( ":" ) ;
69+ const tmBaseUrl = await getTMBaseURL ( ) ;
6870 const res = await apiClient . post ( {
69- url : "https://test-management.browserstack.com/ api/v2/projects" ,
71+ url : ` ${ tmBaseUrl } / api/v2/projects` ,
7072 headers : {
7173 "Content-Type" : "application/json" ,
7274 Authorization :
@@ -95,8 +97,9 @@ export async function createProjectOrFolder(
9597 if ( ! projId )
9698 throw new Error ( "Cannot create folder without project_identifier." ) ;
9799 try {
100+ const tmBaseUrl = await getTMBaseURL ( ) ;
98101 const res = await apiClient . post ( {
99- url : `https://test-management.browserstack.com /api/v2/projects/${ encodeURIComponent (
102+ url : `${ tmBaseUrl } /api/v2/projects/${ encodeURIComponent (
100103 projId ,
101104 ) } /folders`,
102105 headers : {
0 commit comments