feat: Enhance RequestUrlUtils to handle browser Referer for public URL resolution and add corresponding unit tests
This commit is contained in:
@@ -53,6 +53,21 @@ class OutdoorFairControllerTest
|
||||
buildCompanyH5Url(request, 12L, 34L));
|
||||
}
|
||||
|
||||
@Test
|
||||
void companyQrCodeUrlUsesBrowserRefererWhenProxyRewritesHost() throws Exception
|
||||
{
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
request.setScheme("http");
|
||||
request.setServerName("127.0.0.1");
|
||||
request.setServerPort(9091);
|
||||
request.addHeader("Host", "127.0.0.1:9091");
|
||||
request.addHeader("Referer", "http://39.98.44.136:6024/shihezi/jobfair/outdoor-fair/detail?id=8");
|
||||
|
||||
assertEquals(
|
||||
"http://39.98.44.136:6024/h5/outdoor-fair/company.html?fairId=12&companyId=34",
|
||||
buildCompanyH5Url(request, 12L, 34L));
|
||||
}
|
||||
|
||||
private String buildCompanyH5Url(MockHttpServletRequest request, Long fairId, Long companyId)
|
||||
throws Exception
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user