Change Localize endpoint to use route parameter for key
The Localize endpoint in TestLocalizerController now accepts the "key" parameter as a route parameter instead of a query string. The method signature was updated to use [FromRoute], and the route template was modified to include "{key}". This changes the endpoint usage from /localize?key=de_DE to /localize/de_DE.
This commit is contained in:
@@ -23,8 +23,8 @@ namespace EnvelopeGenerator.Web.Controllers.Test
|
|||||||
_cultures = cultures;
|
_cultures = cultures;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet("{key}")]
|
||||||
public IActionResult Localize([FromQuery] string key = "de_DE") => Ok(_localizer[key]);
|
public IActionResult Localize([FromRoute] string key) => Ok(_localizer[key]);
|
||||||
|
|
||||||
[HttpGet("fi-class")]
|
[HttpGet("fi-class")]
|
||||||
public IActionResult GetFIClass(string? lang = null) => lang is null ? Ok(_cultures.FIClasses) : Ok(_cultures[lang]?.FIClass);
|
public IActionResult GetFIClass(string? lang = null) => lang is null ? Ok(_cultures.FIClasses) : Ok(_cultures[lang]?.FIClass);
|
||||||
|
|||||||
Reference in New Issue
Block a user