Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbc35f8b

Browse files
authored
Merge pull requestHaehnchen#1685 from adamwojs/issue_1674
FixedHaehnchen#1674: duplicated route prefix in profiler urls
2 parents6ec4b13 +360a03c commitbc35f8b

File tree

3 files changed

+467
-1
lines changed

3 files changed

+467
-1
lines changed

‎src/main/java/fr/adrienbrault/idea/symfony2plugin/profiler/utils/ProfilerUtil.java‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public static Collection<ProfilerRequestInterface> createRequestsFromIndexHtml(@
128128
if(tokenLink !=null) {
129129
Stringhref =tokenLink.getAttributeValue("href");
130130
if(StringUtils.isNotBlank(href)) {
131-
profilerUrl =StringUtils.stripEnd(baseUrl,"/") +href;
131+
profilerUrl =getProfilerAbsoluteUrl(baseUrl,href);
132132
}
133133
}
134134

@@ -153,6 +153,11 @@ public static Collection<ProfilerRequestInterface> createRequestsFromIndexHtml(@
153153
returnrequests;
154154
}
155155

156+
@NotNull
157+
privatestaticStringgetProfilerAbsoluteUrl(@NotNullStringbaseUrl,@NotNullStringhref) {
158+
returnStringUtils.stripEnd(baseUrl,"/") +href.substring(href.indexOf("/_profiler/"));
159+
}
160+
156161
@NotNull
157162
publicstaticCollection<ProfilerRequestInterface>collectHttpDataForRequest(@NotNullProjectproject,@NotNullCollection<ProfilerRequestInterface>requests) {
158163
Collection<Callable<ProfilerRequestInterface>>callable =requests.stream().map(

‎src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/profiler/ProfilerUtilTest.java‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ public void testCreateRequestsFromIndexHtml() {
3939
assertEquals(404,request.getStatusCode());
4040
}
4141

42+
/**
43+
* @see ProfilerUtil#createRequestsFromIndexHtml
44+
*/
45+
publicvoidtestCreateRequestsFromIndexHtmlRemovesProfilerRoutePrefixFromTokenLinks() {
46+
PsiFilepsiFile =myFixture.configureByFile("profiler-index-with-route-prefix.html");
47+
Collection<ProfilerRequestInterface>requests =ProfilerUtil.createRequestsFromIndexHtml(getProject(),psiFile.getText(),"http://127.0.0.1:8000/prefix/");
48+
49+
ProfilerRequestInterfacerequest =requests.iterator().next();
50+
51+
assertEquals("a9eaab",request.getHash());
52+
assertEquals("GET",request.getMethod());
53+
assertEquals("http://127.0.0.1:8000/prefix/_profiler/search/results?ip=&amp;limit=10",request.getUrl());
54+
assertEquals("http://127.0.0.1:8000/prefix/_profiler/a9eaab",request.getProfilerUrl());
55+
assertEquals(404,request.getStatusCode());
56+
}
57+
4258
/**
4359
* @see ProfilerUtil#getRequestAttributes
4460
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp