1- using graph_tutorial . Helpers ;
1+ using graph_tutorial . Helpers ;
22using Microsoft . Graph ;
33using System ;
44using System . Collections ;
@@ -22,38 +22,38 @@ public class GraphProxyController : ApiController
2222 [ Route ( "{*all}" ) ]
2323 public async Task < HttpResponseMessage > GetAsync ( string all )
2424 {
25- return await ProcessRequestAsync ( " GET" , all , null ) . ConfigureAwait ( false ) ;
25+ return await ProcessRequestAsync ( HttpMethods . GET , all , null ) . ConfigureAwait ( false ) ;
2626 }
2727
2828 [ HttpPost ]
2929 [ Route ( "{*all}" ) ]
3030 public async Task < HttpResponseMessage > PostAsync ( string all , [ FromBody ] object body )
3131 {
32- return await ProcessRequestAsync ( " POST" , all , body ) . ConfigureAwait ( false ) ;
32+ return await ProcessRequestAsync ( HttpMethods . POST , all , body ) . ConfigureAwait ( false ) ;
3333 }
3434
3535 [ HttpDelete ]
3636 [ Route ( "{*all}" ) ]
3737 public async Task < HttpResponseMessage > DeleteAsync ( string all )
3838 {
39- return await ProcessRequestAsync ( " DELETE" , all , null ) . ConfigureAwait ( false ) ;
39+ return await ProcessRequestAsync ( HttpMethods . DELETE , all , null ) . ConfigureAwait ( false ) ;
4040 }
4141
4242 [ HttpPut ]
4343 [ Route ( "{*all}" ) ]
4444 public async Task < HttpResponseMessage > PutAsync ( string all , [ FromBody ] object body )
4545 {
46- return await ProcessRequestAsync ( " PUT" , all , body ) . ConfigureAwait ( false ) ;
46+ return await ProcessRequestAsync ( HttpMethods . PUT , all , body ) . ConfigureAwait ( false ) ;
4747 }
4848
4949 [ HttpPatch ]
5050 [ Route ( "{*all}" ) ]
5151 public async Task < HttpResponseMessage > PatchAsync ( string all , [ FromBody ] object body )
5252 {
53- return await ProcessRequestAsync ( " PATCH" , all , body ) . ConfigureAwait ( false ) ;
53+ return await ProcessRequestAsync ( HttpMethods . PATCH , all , body ) . ConfigureAwait ( false ) ;
5454 }
5555
56- private async Task < HttpResponseMessage > ProcessRequestAsync ( string method , string all , object content )
56+ private async Task < HttpResponseMessage > ProcessRequestAsync ( HttpMethods method , string all , object content )
5757 {
5858 var graphClient = GraphHelper . GetAuthenticatedClient ( ) ;
5959
@@ -77,7 +77,7 @@ private async Task<HttpResponseMessage> ProcessRequestAsync(string method, strin
7777
7878 try
7979 {
80- using ( var response = await request . SendRequestAsync ( content , CancellationToken . None , HttpCompletionOption . ResponseContentRead ) . ConfigureAwait ( false ) )
80+ using ( var response = await request . SendRequestAsync ( content ? . ToString ( ) , CancellationToken . None , HttpCompletionOption . ResponseContentRead ) . ConfigureAwait ( false ) )
8181 {
8282 response . Content . Headers . TryGetValues ( "content-type" , out var contentTypes ) ;
8383
0 commit comments