@@ -20,11 +20,6 @@ namespace Microsoft.Graph
20
20
/// </summary>
21
21
public class BaseRequest : IBaseRequest
22
22
{
23
- /// The key for the SDK version header.
24
- protected string sdkVersionHeaderName ;
25
- /// The value for the SDK version header.
26
- protected string sdkVersionHeaderValue ;
27
-
28
23
/// <summary>
29
24
/// Constructs a new <see cref="BaseRequest"/>.
30
25
/// </summary>
@@ -43,9 +38,6 @@ public BaseRequest(
43
38
44
39
this . RequestUrl = this . InitializeUrl ( requestUrl ) ;
45
40
46
- this . sdkVersionHeaderName = CoreConstants . Headers . SdkVersionHeaderName ;
47
- this . SdkVersionHeaderPrefix = "Graph" ;
48
-
49
41
if ( options != null )
50
42
{
51
43
var headerOptions = options . OfType < HeaderOption > ( ) ;
@@ -91,11 +83,6 @@ public BaseRequest(
91
83
/// Gets the URL for the request, without query string.
92
84
/// </summary>
93
85
public string RequestUrl { get ; internal set ; }
94
-
95
- /// <summary>
96
- /// Gets or sets the telemetry header prefix for requests.
97
- /// </summary>
98
- protected string SdkVersionHeaderPrefix { get ; set ; }
99
86
100
87
/// <summary>
101
88
/// Sends the request.
@@ -202,22 +189,10 @@ public async Task<HttpResponseMessage> SendMultiPartRequestAsync(
202
189
} ) ;
203
190
}
204
191
205
- if ( this . Client . AuthenticationProvider == null )
206
- {
207
- throw new ServiceException (
208
- new Error
209
- {
210
- Code = ErrorConstants . Codes . InvalidRequest ,
211
- Message = ErrorConstants . Messages . AuthenticationProviderMissing ,
212
- } ) ;
213
- }
214
-
215
192
if ( multipartContent != null )
216
193
{
217
194
using ( var request = this . GetHttpRequestMessage ( ) )
218
195
{
219
- await this . AuthenticateRequest ( request ) . ConfigureAwait ( false ) ;
220
-
221
196
request . Content = multipartContent ;
222
197
223
198
return await this . Client . HttpProvider . SendAsync ( request , completionOption , cancellationToken ) . ConfigureAwait ( false ) ;
@@ -251,20 +226,8 @@ public async Task<HttpResponseMessage> SendRequestAsync(
251
226
} ) ;
252
227
}
253
228
254
- if ( this . Client . AuthenticationProvider == null )
255
- {
256
- throw new ServiceException (
257
- new Error
258
- {
259
- Code = ErrorConstants . Codes . InvalidRequest ,
260
- Message = ErrorConstants . Messages . AuthenticationProviderMissing ,
261
- } ) ;
262
- }
263
-
264
229
using ( var request = this . GetHttpRequestMessage ( ) )
265
230
{
266
- await this . AuthenticateRequest ( request ) . ConfigureAwait ( false ) ;
267
-
268
231
if ( serializableObject != null )
269
232
{
270
233
var inputStream = serializableObject as Stream ;
@@ -296,12 +259,25 @@ public HttpRequestMessage GetHttpRequestMessage()
296
259
{
297
260
var queryString = this . BuildQueryString ( ) ;
298
261
var request = new HttpRequestMessage ( new HttpMethod ( this . Method ) , string . Concat ( this . RequestUrl , queryString ) ) ;
299
-
300
262
this . AddHeadersToRequest ( request ) ;
301
-
302
263
return request ;
303
264
}
304
265
266
+ /// <summary>
267
+ /// Adds all of the headers from the header collection to the request.
268
+ /// </summary>
269
+ /// <param name="request">The <see cref="HttpRequestMessage"/> representation of the request.</param>
270
+ private void AddHeadersToRequest ( HttpRequestMessage request )
271
+ {
272
+ if ( this . Headers != null )
273
+ {
274
+ foreach ( var header in this . Headers )
275
+ {
276
+ request . Headers . TryAddWithoutValidation ( header . Name , header . Value ) ;
277
+ }
278
+ }
279
+ }
280
+
305
281
/// <summary>
306
282
/// Gets a URL that is the request builder's request URL with the segment appended.
307
283
/// </summary>
@@ -340,47 +316,6 @@ internal string BuildQueryString()
340
316
return null ;
341
317
}
342
318
343
- /// <summary>
344
- /// Adds all of the headers from the header collection to the request.
345
- /// </summary>
346
- /// <param name="request">The <see cref="HttpRequestMessage"/> representation of the request.</param>
347
- private void AddHeadersToRequest ( HttpRequestMessage request )
348
- {
349
- if ( this . Headers != null )
350
- {
351
- foreach ( var header in this . Headers )
352
- {
353
- request . Headers . TryAddWithoutValidation ( header . Name , header . Value ) ;
354
- }
355
- }
356
-
357
- if ( string . IsNullOrEmpty ( this . sdkVersionHeaderValue ) )
358
- {
359
- var assemblyVersion = this . GetType ( ) . GetTypeInfo ( ) . Assembly . GetName ( ) . Version ;
360
- this . sdkVersionHeaderValue = string . Format (
361
- CoreConstants . Headers . SdkVersionHeaderValueFormatString ,
362
- this . SdkVersionHeaderPrefix ,
363
- assemblyVersion . Major ,
364
- assemblyVersion . Minor ,
365
- assemblyVersion . Build ) ;
366
- }
367
-
368
- // Append SDK version header for telemetry
369
- request . Headers . Add (
370
- this . sdkVersionHeaderName ,
371
- this . sdkVersionHeaderValue ) ;
372
- }
373
-
374
- /// <summary>
375
- /// Adds the authentication header to the request.
376
- /// </summary>
377
- /// <param name="request">The <see cref="HttpRequestMessage"/> representation of the request.</param>
378
- /// <returns>The task to await.</returns>
379
- private Task AuthenticateRequest ( HttpRequestMessage request )
380
- {
381
- return this . Client . AuthenticationProvider . AuthenticateRequestAsync ( request ) ;
382
- }
383
-
384
319
/// <summary>
385
320
/// Initializes the request URL for the request, breaking it into query options and base URL.
386
321
/// </summary>
0 commit comments