Micronaut-core: Feature request: add support absolute URIs in UriMatchTemplate

Created on 30 Nov 2020  路  8Comments  路  Source: micronaut-projects/micronaut-core

The current implementation of UriMatchTemplate only supports relative URIs:

String urlFormat = "/post/{+postSlug}";

UriMatchTemplate template = UriMatchTemplate.of(urlFormat);

// will return: Optional[/post/abc]
Optional<UriMatchInfo> match = template.match("/post/abc");

But if change urlFormat to the absolute URI template, it will not work as expected:

String urlFormat = "https://www.mydomain.com/post/{+postSlug}";

UriMatchTemplate template = UriMatchTemplate.of(urlFormat);

// will return: Optional.empty
Optional<UriMatchInfo> match = template.match("https://www.mydomain.com/post/abc");
help wanted good first issue

All 8 comments

Hi! If there is no one working on this I would like to tackle it.

Sounds great!

@preyest1300 Wow!!! Thank you so much!!!

Hi Guys.

I think I have solved this issue. Below is the output after I made changes.

> Task :http:uriMatchTemplateTest.main()
Optional[/post/abc]
Optional[https://www.mydomain.com/post/abc]

Is this what you are expecting for this issue.

Thanks
Lovepreet Singh

Yes, looks correct.

Sounds good then. I will create a PR for this issue. But do I need to write groovy test case, as I don't saw any junit test cases for this project.

4682, Add the PR for the above issue

@loveshah751 thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adityasrini picture adityasrini  路  5Comments

rt-works picture rt-works  路  4Comments

iBernd81 picture iBernd81  路  3Comments

gitjxm picture gitjxm  路  3Comments

markjfisher picture markjfisher  路  5Comments