@@ -12,13 +12,43 @@ function queryStringify(query: Record<string, any>) {
1212 } ) ;
1313}
1414
15+ type httpMethod =
16+ | "GET"
17+ | "HEAD"
18+ | "POST"
19+ | "PUT"
20+ | "DELETE"
21+ | "CONNECT"
22+ | "OPTIONS"
23+ | "TRACE"
24+ | "PATCH" ;
25+
1526let apiReqCount = 0 ;
1627
1728export function getRequestRaw (
29+ logger : Log . Logger ,
30+ cfg : RuntimeConfiguration ,
31+ path : string ,
32+ query : Record < string , any > = { }
33+ ) : Promise < Response > {
34+ return requestRaw ( logger , cfg , path , query , "GET" ) ;
35+ }
36+
37+ export function deleteRequestRaw (
38+ logger : Log . Logger ,
39+ cfg : RuntimeConfiguration ,
40+ path : string ,
41+ query : Record < string , any > = { }
42+ ) : Promise < Response > {
43+ return requestRaw ( logger , cfg , path , query , "DELETE" ) ;
44+ }
45+
46+ function requestRaw (
1847 logger : Log . Logger ,
1948 cfg : RuntimeConfiguration ,
2049 path : string ,
2150 query : Record < string , any > = { } ,
51+ method : httpMethod = "GET"
2252) : Promise < Response > {
2353 return handleApiErrors ( logger , async ( ) => {
2454 const reqNumber = apiReqCount ++ ;
@@ -30,14 +60,15 @@ export function getRequestRaw(
3060
3161 const url = `https://${ apiHost ( cfg ) } /v1${ path } ?${ queryStringify ( query ) } ` ;
3262
33- logger . debug ( `api dispatch: ${ reqNumber } : url ${ url } (query: ${ JSON . stringify ( query ) } )` ) ;
63+ logger . debug ( `api dispatch: ${ reqNumber } : method: ${ method } url ${ url } (query: ${ JSON . stringify ( query ) } )` ) ;
3464
3565 const response = await fetch ( url , {
3666 headers : {
3767 authorization,
3868 'user-agent' : `Render CLI/${ VERSION } ` ,
3969 accept : 'application/json' ,
4070 } ,
71+ method : method ,
4172 } ) ;
4273 if ( ! response . ok ) {
4374 // this kind of has to be a DOMException because it encapsulates the notion of NetworkError
0 commit comments