Skip to content

Commit 151e733

Browse files
committed
preserve all entries in GraphQLRequest
1 parent 61373d7 commit 151e733

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/GraphQL.Client/GraphQLHttpRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public GraphQLHttpRequest(string query, object? variables = null, string? operat
1616
{
1717
}
1818

19-
public GraphQLHttpRequest(GraphQLRequest other): base(other.Query, other.Variables, other.OperationName)
19+
public GraphQLHttpRequest(GraphQLRequest other): base(other)
2020
{
2121
}
2222

src/GraphQL.Primitives/GraphQLRequest.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ public GraphQLRequest(string query, object? variables = null, string? operationN
4949
OperationName = operationName;
5050
}
5151

52+
public GraphQLRequest(IEnumerable<KeyValuePair<string, object>> values)
53+
{
54+
foreach(var kv in values)
55+
{
56+
Add(kv.Key, kv.Value);
57+
}
58+
}
59+
5260
/// <summary>
5361
/// Returns a value that indicates whether this instance is equal to a specified object
5462
/// </summary>
@@ -86,7 +94,7 @@ public override int GetHashCode()
8694
{
8795
unchecked
8896
{
89-
var hashCode = Query.GetHashCode();
97+
var hashCode = Query?.GetHashCode() ?? 0;
9098
hashCode = (hashCode * 397) ^ OperationName?.GetHashCode() ?? 0;
9199
hashCode = (hashCode * 397) ^ Variables?.GetHashCode() ?? 0;
92100
return hashCode;

0 commit comments

Comments
 (0)