micronaut-projects / micronaut-core

Micronaut Application Framework
http://micronaut.io
Apache License 2.0
6.1k stars 1.07k forks source link

Micronaut 4 throws 404 error for an endpoint having special characters in path parameter #10919

Open AshPrajapati opened 5 months ago

AshPrajapati commented 5 months ago

Expected Behavior

When we hit the API with special characters i.e. http://localhost:8080/search - (Js - on). Micronaut 3 responds with success(200). We should expect success from Micronaut 4 for the example API call.

Actual Behaviour

But we are getting 404 on calling http://localhost:8080/search - (Js - on).

image

Steps To Reproduce

  1. Create a controller with the Path parameter
  2. In the path parameter, we should pass special characters when we call the API

Environment Information

Example Application

https://github.com/AshPrajapati/Micronaut-Special-Character-URL-Issue/tree/micronaut-4

Version

Version: 4.4.0

Note: We have created a GitHub repository that contains two branches(i.e. one for Micronaut 3.0 and another for Micronaut 4.0). We can use the gradle run command to run the application.

waynerijsdijk commented 5 months ago

Change @Get("/{message}") to @Get("/{+message}") in your EchoController and it will work again.

Search for URI Reserved Character Matching on https://docs.micronaut.io/latest/guide/