@@ -19,42 +19,42 @@ public static class ClientHelpers
19
19
internal static async Task < T ? > ReadJsonContentAsync < T > ( HttpContent content )
20
20
=> await content . ReadFromJsonAsync < T ? > ( ) ;
21
21
22
- public static async Task < T ? > GetAsync < T > ( HttpClient client , string route , int ? resourceId = null , ILogger ? logger = null )
22
+ public static async Task < T ? > GetAsync < T > ( HttpClient client , string apiRoute , string route , int ? resourceId = null , ILogger ? logger = null )
23
23
=> await SendRequestAsync (
24
24
client ,
25
- FormRoute ( route , resourceId ) ,
26
- ( ) => client . GetAsync ( FormRoute ( route , resourceId ) ) ,
25
+ FormRoute ( apiRoute , route , resourceId ) ,
26
+ ( ) => client . GetAsync ( FormRoute ( apiRoute , route , resourceId ) ) ,
27
27
ReadJsonContentAsync < T ? > ,
28
28
logger ) ?? default ;
29
29
30
- public static async Task < bool > DeleteAsync ( HttpClient client , string route , int resourceId , ILogger ? logger = null )
30
+ public static async Task < bool > DeleteAsync ( HttpClient client , string apiRoute , string route , int resourceId , ILogger ? logger = null )
31
31
=> await SendRequestAsync < bool ? > (
32
32
client ,
33
- FormRoute ( route , resourceId ) ,
34
- ( ) => client . DeleteAsync ( FormRoute ( route , resourceId ) ) ,
33
+ FormRoute ( apiRoute , route , resourceId ) ,
34
+ ( ) => client . DeleteAsync ( FormRoute ( apiRoute , route , resourceId ) ) ,
35
35
null ,
36
36
logger ) != null ;
37
37
38
- public static async Task < T ? > PostAsync < T > ( HttpClient client , string route , T request , ILogger ? logger = null )
38
+ public static async Task < T ? > PostAsync < T > ( HttpClient client , string apiRoute , string route , T request , ILogger ? logger = null )
39
39
=> await SendRequestAsync (
40
40
client ,
41
- FormRoute ( route , null ) ,
42
- ( ) => client . PostAsJsonAsync ( FormRoute ( route , null ) , request ) ,
41
+ FormRoute ( apiRoute , route , null ) ,
42
+ ( ) => client . PostAsJsonAsync ( FormRoute ( apiRoute , route , null ) , request ) ,
43
43
ReadJsonContentAsync < T ? > ,
44
44
logger ) ?? default ;
45
45
46
- public static async Task < T ? > PutAsync < T > ( HttpClient client , string route , int resourceId , T request , ILogger ? logger = null )
46
+ public static async Task < T ? > PutAsync < T > ( HttpClient client , string apiRoute , string route , int resourceId , T request , ILogger ? logger = null )
47
47
=> await SendRequestAsync (
48
48
client ,
49
- FormRoute ( route , resourceId ) ,
50
- ( ) => client . PutAsJsonAsync ( FormRoute ( route , resourceId ) , request ) ,
49
+ FormRoute ( apiRoute , route , resourceId ) ,
50
+ ( ) => client . PutAsJsonAsync ( FormRoute ( apiRoute , route , resourceId ) , request ) ,
51
51
ReadJsonContentAsync < T ? > ,
52
52
logger ) ?? default ;
53
53
54
- static string FormRoute ( string baseRoute , int ? resourceId )
54
+ static string FormRoute ( string apiRoute , string baseRoute , int ? resourceId )
55
55
=> resourceId == null
56
- ? baseRoute
57
- : baseRoute + $ "/{ resourceId } ";
56
+ ? apiRoute + baseRoute
57
+ : apiRoute + baseRoute + $ "/{ resourceId } ";
58
58
59
59
internal static async Task < T ? > SendRequestAsync < T > ( HttpClient client , string route , Func < Task < HttpResponseMessage > > httpFunc , Func < HttpContent , Task < T ? > > ? contentReaderFunc = null , ILogger ? logger = null )
60
60
{
@@ -85,7 +85,7 @@ static string FormRoute(string baseRoute, int? resourceId)
85
85
return default ;
86
86
}
87
87
88
- logger ? . Debug ( "Received success response" ) ;
88
+ logger ? . Debug ( $ "Received success response: { response . StatusCode } ") ;
89
89
90
90
if ( contentReaderFunc != null )
91
91
{
0 commit comments