mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-21 22:55:12 +00:00
patch the serializer for our silly OAuth response format
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Reflection;
|
||||
@@ -123,6 +124,17 @@ namespace Octokit.Internal
|
||||
return Enum.Parse(underlyingType, stringValue, ignoreCase: true);
|
||||
}
|
||||
}
|
||||
|
||||
if (ReflectionUtils.IsTypeGenericeCollectionInterface(type))
|
||||
{
|
||||
// OAuth tokens might be a string of comma-separated values
|
||||
// we should only try this if the return array is a collection of strings
|
||||
var innerType = ReflectionUtils.GetGenericListElementType(type);
|
||||
if (innerType.IsAssignableFrom(typeof(string)))
|
||||
{
|
||||
return stringValue.Split(',');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return base.DeserializeObject(value, type);
|
||||
|
||||
Reference in New Issue
Block a user