Skip to content
This repository has been archived by the owner on Dec 9, 2020. It is now read-only.

Commit

Permalink
Fixed problem with reading request values
Browse files Browse the repository at this point in the history
Fixed problem with reading form and request values to internal request
collection.
  • Loading branch information
gpeipman committed Dec 18, 2012
1 parent ad17e0f commit b42a510
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/OAuth2Provider/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,16 @@ public static void SafeAddRange<TKey, TValue>(this IDictionary<TKey, IList<TValu
public static void SafeAdd<TKey, T>(this IDictionary<TKey, IList<T>> dictionary, TKey key, IList<T> items)
{
IList<T> existingItems = null;
dictionary.TryGetValue(key, out items);
dictionary.TryGetValue(key, out existingItems);

if (existingItems == null)
{
existingItems = new List<T>();

existingItems.AddRange(items);
existingItems.AddRange(items);
dictionary[key] = existingItems;
}
else
existingItems.AddRange(items);
}

public static string ToQueryString(this NameValueCollection nvc)
Expand Down Expand Up @@ -204,13 +208,13 @@ public static string ToJson(this object obj)
public static HttpBasicAuthenticationScheme DecodeBasicAuthentication(this IRequest request)
{
return new HttpBasicAuthenticationScheme(request);
}

public static bool IsFormEncoded(this IOAuthRequest request)
{
// Content-Type may or may not include the character encoding (e.g. charset=UTF-8)
var contentType = request.ContentType;
return !string.IsNullOrEmpty(contentType) && contentType.StartsWith(ContentType.FormEncoded, StringComparison.OrdinalIgnoreCase);
}

public static bool IsFormEncoded(this IOAuthRequest request)
{
// Content-Type may or may not include the character encoding (e.g. charset=UTF-8)
var contentType = request.ContentType;
return !string.IsNullOrEmpty(contentType) && contentType.StartsWith(ContentType.FormEncoded, StringComparison.OrdinalIgnoreCase);
}
}
}

0 comments on commit b42a510

Please sign in to comment.