justinmclean opened a new issue, #9123:
URL: https://github.com/apache/gravitino/issues/9123

   ### What would you like to be improved?
   
   
   In server/src/main/java/org/apache/gravitino/server/web/ui/WebUIFilter.java 
fix UI routes ending in a trailing slash resolve to index.html.
   
   Here's some unit tests to help:
   ```
     @Test
     public void testDirectoryRequestForwardsToIndexHtml() throws 
ServletException, IOException {
       WebUIFilter filter = new WebUIFilter();
       HttpServletRequest request = mock(HttpServletRequest.class);
       ServletResponse response = mock(ServletResponse.class);
       FilterChain chain = mock(FilterChain.class);
       RequestDispatcher dispatcher = mock(RequestDispatcher.class);
   
       when(request.getRequestURI()).thenReturn("/ui/section/");
       
when(request.getRequestDispatcher("/ui/section/index.html")).thenReturn(dispatcher);
   
       filter.doFilter(request, response, chain);
   
       verify(dispatcher).forward(request, response);
       verify(chain, never()).doFilter(any(), any());
     }
   
     @Test
     public void testHtmlRequestWithoutExtensionAppendsHtml() throws 
ServletException, IOException {
       WebUIFilter filter = new WebUIFilter();
       HttpServletRequest request = mock(HttpServletRequest.class);
       ServletResponse response = mock(ServletResponse.class);
       FilterChain chain = mock(FilterChain.class);
       RequestDispatcher dispatcher = mock(RequestDispatcher.class);
   
       when(request.getRequestURI()).thenReturn("/ui/dashboard");
       
when(request.getRequestDispatcher("/ui/dashboard.html")).thenReturn(dispatcher);
   
       filter.doFilter(request, response, chain);
   
       verify(dispatcher).forward(request, response);
       verify(chain, never()).doFilter(any(), any());
     }
   ```
   
   ### How should we improve?
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to