Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
ba6a414d
Commit
ba6a414d
authored
Dec 11, 2014
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix double slashes in eureka server
fixes gh-100
parent
a2fade98
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
2 deletions
+22
-2
EurekaController.java
...amework/cloud/netflix/eureka/server/EurekaController.java
+6
-2
ApplicationServletPathTests.java
...ud/netflix/eureka/server/ApplicationServletPathTests.java
+1
-0
ApplicationTests.java
...amework/cloud/netflix/eureka/server/ApplicationTests.java
+15
-0
No files found.
spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/EurekaController.java
View file @
ba6a414d
...
...
@@ -69,10 +69,14 @@ public class EurekaController {
return
map
;
}
pr
ivate
void
populateBase
(
HttpServletRequest
request
,
Map
<
String
,
Object
>
model
)
{
pr
otected
void
populateBase
(
HttpServletRequest
request
,
Map
<
String
,
Object
>
model
)
{
String
servletPath
=
request
.
getServletPath
();
String
path
=
request
.
getContextPath
()
+
(
servletPath
==
null
?
""
:
servletPath
);
String
basePath
=
request
.
getScheme
()+
"://"
+
request
.
getServerName
()+
":"
+
request
.
getServerPort
()+
path
+
"/"
;
String
basePath
=
request
.
getScheme
()+
"://"
+
request
.
getServerName
()+
":"
+
request
.
getServerPort
()+
path
;
if
(!
basePath
.
endsWith
(
"/"
))
{
basePath
+=
"/"
;
}
model
.
put
(
"time"
,
new
Date
());
model
.
put
(
"basePath"
,
basePath
);
...
...
spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationServletPathTests.java
View file @
ba6a414d
package
org
.
springframework
.
cloud
.
netflix
.
eureka
.
server
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
java.util.Map
;
...
...
spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationTests.java
View file @
ba6a414d
package
org
.
springframework
.
cloud
.
netflix
.
eureka
.
server
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
java.util.Map
;
...
...
@@ -54,4 +56,17 @@ public class ApplicationTests {
assertEquals
(
HttpStatus
.
OK
,
entity
.
getStatusCode
());
}
@Test
public
void
noDoubleSlashes
()
{
String
basePath
=
"http://localhost:"
+
port
+
"/"
;
ResponseEntity
<
String
>
entity
=
new
TestRestTemplate
().
getForEntity
(
basePath
,
String
.
class
);
assertEquals
(
HttpStatus
.
OK
,
entity
.
getStatusCode
());
String
body
=
entity
.
getBody
();
assertNotNull
(
body
);
assertFalse
(
"basePath contains double slashes"
,
body
.
contains
(
basePath
+
"/"
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment