Skip to content
Draft
Show file tree
Hide file tree
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
30 changes: 30 additions & 0 deletions src/HotChocolate/Core/test/Execution.Tests/RequestExecutorTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Text.Json;
using HotChocolate.Tests;
using HotChocolate.Types;
using Microsoft.Extensions.DependencyInjection;
Expand Down Expand Up @@ -94,6 +95,35 @@ public async Task CancellationToken_Is_Passed_Correctly()
Assert.True(tokenWasCorrectlyPassedToResolver);
}

[Fact]
public async Task DeleteChar_StringInput_IsAllowed()
{
var schema = SchemaBuilder.New()
.AddQueryType(t => t
.Name("Query")
.Field("echo")
.Argument("arg", arg => arg.Type<StringType>())
.Resolve(x => x.ArgumentValue<string>("arg")))
.Create();

// act
var executor = schema.MakeExecutable();
var result = await executor.ExecuteAsync($$""""
{
delChar: echo(arg: "\u007F")
delCharNonEscaped: echo(arg: "{{"\u007f"}}")
delCharNonEscapedBlockString: echo(arg:
"""
{{"\u007f"}}
""")
#Comment with del char -> {{"\u007f"}} <-
}
"""");

// assert
result.MatchSnapshot();
}

[Fact]
public async Task Ensure_Errors_Do_Not_Result_In_Timeouts()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"data": {
"delChar": "\u007F",
"delCharNonEscaped": "\u007F",
"delCharNonEscapedBlockString": "\u007F\n"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ internal static class GraphQLConstants
public const byte GroupSeparator = 29;
public const byte RecordSeparator = 30;
public const byte UnitSeparator = 31;
public const byte Delete = 127;

public const byte A = (byte)'a';
public const byte B = (byte)'b';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,6 @@ private void ReadCommentToken()
case GraphQLConstants.GroupSeparator:
case GraphQLConstants.RecordSeparator:
case GraphQLConstants.UnitSeparator:
case GraphQLConstants.Delete:
run = false;
break;

Expand Down Expand Up @@ -581,7 +580,6 @@ private void ReadStringValueToken()
case GraphQLConstants.GroupSeparator:
case GraphQLConstants.RecordSeparator:
case GraphQLConstants.UnitSeparator:
case GraphQLConstants.Delete:
throw new SyntaxException(this, InvalidCharacterWithinString, code);
}
}
Expand Down Expand Up @@ -674,7 +672,6 @@ private void ReadBlockStringToken()
case GraphQLConstants.GroupSeparator:
case GraphQLConstants.RecordSeparator:
case GraphQLConstants.UnitSeparator:
case GraphQLConstants.Delete:
throw new SyntaxException(
this,
string.Format(InvalidCharacterWithinString, code));
Expand Down