Skip to content

Commit a6eccb7

Browse files
JerryNixonAniruddh25RubenCerna2079
authored
Favicon.ico is not an error. (#2640)
Closes #2539 Prevents error message in console that is not a real error. ![image](https://github.com/user-attachments/assets/3794163c-323f-4685-b933-f53afdf71420) --------- Co-authored-by: Aniruddh Munde <[email protected]> Co-authored-by: Ruben Cerna <[email protected]> Co-authored-by: RubenCerna2079 <[email protected]>
1 parent f1f2019 commit a6eccb7

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

src/Service.Tests/Configuration/ConfigurationTests.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1982,11 +1982,9 @@ public void TestGetConfigFileNameForEnvironment(
19821982
[DataRow("/graphql?query={book_by_pk(id: 1){title}}",
19831983
HostMode.Production, HttpStatusCode.OK, "data",
19841984
DisplayName = "GraphQL endpoint with query in production mode.")]
1985-
[DataRow(RestController.REDIRECTED_ROUTE, HostMode.Development, HttpStatusCode.BadRequest,
1986-
"GraphQL request redirected to favicon.ico.",
1985+
[DataRow(RestController.REDIRECTED_ROUTE, HostMode.Development, HttpStatusCode.NotFound, "Not Found",
19871986
DisplayName = "Redirected endpoint in development mode.")]
1988-
[DataRow(RestController.REDIRECTED_ROUTE, HostMode.Production, HttpStatusCode.BadRequest,
1989-
"GraphQL request redirected to favicon.ico.",
1987+
[DataRow(RestController.REDIRECTED_ROUTE, HostMode.Production, HttpStatusCode.NotFound, "Not Found",
19901988
DisplayName = "Redirected endpoint in production mode.")]
19911989
public async Task TestInteractiveGraphQLEndpoints(
19921990
string endpoint,
@@ -2010,8 +2008,8 @@ public async Task TestInteractiveGraphQLEndpoints(
20102008
File.WriteAllText(CUSTOM_CONFIG, configWithCustomHostMode.ToJson());
20112009
string[] args = new[]
20122010
{
2013-
$"--ConfigFileName={CUSTOM_CONFIG}"
2014-
};
2011+
$"--ConfigFileName={CUSTOM_CONFIG}"
2012+
};
20152013

20162014
using TestServer server = new(Program.CreateWebHostBuilder(args));
20172015
using HttpClient client = server.CreateClient();

src/Service/Controllers/RestController.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,7 @@ private async Task<IActionResult> HandleOperation(
189189
{
190190
if (route.Equals(REDIRECTED_ROUTE))
191191
{
192-
throw new DataApiBuilderException(
193-
message: $"GraphQL request redirected to {REDIRECTED_ROUTE}.",
194-
statusCode: HttpStatusCode.BadRequest,
195-
subStatusCode: DataApiBuilderException.SubStatusCodes.BadRequest);
192+
return NotFound();
196193
}
197194

198195
// Validate the PathBase matches the configured REST path.

0 commit comments

Comments
 (0)