Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions src/Docker.DotNet/QueryString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public IDictionary<string, string[]> GetKeyValuePairs()
}

// Serialize
if (attribute.IsRequired || !IsDefaultOfType(value))
if (value != null)
{
var keyStr = attribute.Name;
string[] valueStr;
Expand Down Expand Up @@ -113,16 +113,6 @@ private Tuple<PropertyInfo, TAttribType>[] FindAttributedPublicProperties<TValue
return attributedPublicProperties.Select(pi =>
new Tuple<PropertyInfo, TAttribType>(pi, pi.GetCustomAttribute<TAttribType>())).ToArray();
}

private static bool IsDefaultOfType(object o)
{
if (o is ValueType)
{
return o.Equals(Activator.CreateInstance(o.GetType()));
}

return o == null;
}
}

/// <summary>
Expand Down Expand Up @@ -151,4 +141,4 @@ public string GetQueryString()
v => $"{Uri.EscapeUriString(_key)}={Uri.EscapeDataString(v)}"));
}
}
}
}