Skip to content

Commit af46bd5

Browse files
authored
Merge pull request #291 from bjorg/graphql-request-fixes
GraphQLRequest fixes
2 parents d8defa2 + 15f1045 commit af46bd5

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
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: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public GraphQLRequest(string query, object? variables = null, string? operationN
4949
OperationName = operationName;
5050
}
5151

52+
public GraphQLRequest(GraphQLRequest other): base(other) { }
53+
5254
/// <summary>
5355
/// Returns a value that indicates whether this instance is equal to a specified object
5456
/// </summary>
@@ -82,16 +84,7 @@ public virtual bool Equals(GraphQLRequest? other)
8284
/// <summary>
8385
/// <inheritdoc cref="object.GetHashCode"/>
8486
/// </summary>
85-
public override int GetHashCode()
86-
{
87-
unchecked
88-
{
89-
var hashCode = Query.GetHashCode();
90-
hashCode = (hashCode * 397) ^ OperationName?.GetHashCode() ?? 0;
91-
hashCode = (hashCode * 397) ^ Variables?.GetHashCode() ?? 0;
92-
return hashCode;
93-
}
94-
}
87+
public override int GetHashCode() => (Query, OperationName, Variables).GetHashCode();
9588

9689
/// <summary>
9790
/// Tests whether two specified <see cref="GraphQLRequest"/> instances are equivalent

0 commit comments

Comments
 (0)