File tree Expand file tree Collapse file tree 4 files changed +16
-1
lines changed
src/Authentication/Authentication Expand file tree Collapse file tree 4 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -453,6 +453,10 @@ internal async Task ProcessResponseAsync(HttpResponseMessage response)
453
453
throw new ArgumentOutOfRangeException ( nameof ( OutputType ) ) ;
454
454
}
455
455
break ;
456
+ case RestReturnType . PlainText :
457
+ responseString = await response . Content . ReadAsStringAsync ( ) ;
458
+ WriteObject ( responseString ) ;
459
+ break ;
456
460
case RestReturnType . OctetStream :
457
461
if ( OutputType == OutputType . HttpResponseMessage )
458
462
WriteObject ( response ) ;
Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ internal static RestReturnType CheckReturnType(this HttpResponseMessage response
29
29
rt = RestReturnType . Image ;
30
30
else if ( IsOctetStream ( contentType ) )
31
31
rt = RestReturnType . OctetStream ;
32
+ else if ( IsPlainText ( contentType ) )
33
+ rt = RestReturnType . PlainText ;
32
34
return rt ;
33
35
}
34
36
@@ -80,6 +82,8 @@ private static bool CheckIsOctetStream(string contentType)
80
82
return isOctetStream ;
81
83
}
82
84
85
+ private static bool IsPlainText ( string contentType ) => contentType . Equals ( "text/plain" , StringComparison . OrdinalIgnoreCase ) ;
86
+
83
87
// used to split contentType arguments
84
88
private static readonly char [ ] ContentTypeParamSeparator = { ';' } ;
85
89
Original file line number Diff line number Diff line change @@ -24,6 +24,10 @@ public enum RestReturnType
24
24
/// <summary>
25
25
/// image/* (image/jpeg, image/png) return type
26
26
/// </summary>
27
- Image = 4
27
+ Image = 4 ,
28
+ /// <summary>
29
+ /// text/plain return type
30
+ /// </summary>
31
+ PlainText = 5
28
32
}
29
33
}
Original file line number Diff line number Diff line change @@ -54,6 +54,9 @@ Describe 'Invoke-MgGraphRequest Command' -skip {
54
54
It ' Should not throw when -InferOutputFilePath is specified' {
55
55
{ Invoke-MgGraphRequest - OutputType PSObject - Uri " https://graph.microsoft.com/v1.0/reports/getTeamsUserActivityUserDetail(period='D7')" - InferOutputFileName } | Should -Not - Throw
56
56
}
57
+ It ' Should return plain text' {
58
+ { Invoke-MgGraphRequest - Uri " https://graph.microsoft.com/v1.0/applications/`$ count" } | Should - BeOfType [System.String ]
59
+ }
57
60
}
58
61
59
62
Context ' Absolute and relative URIs' {
You can’t perform that action at this time.
0 commit comments