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
bd5d00c0
Commit
bd5d00c0
authored
May 18, 2015
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
encode uri if needed
fixes gh-347
parent
8bb578ad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
RibbonCommand.java
...ework/cloud/netflix/zuul/filters/route/RibbonCommand.java
+5
-2
SampleZuulProxyApplicationTests.java
...k/cloud/netflix/zuul/SampleZuulProxyApplicationTests.java
+14
-0
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/RibbonCommand.java
View file @
bd5d00c0
...
...
@@ -21,6 +21,10 @@ import java.net.URI;
import
java.net.URISyntaxException
;
import
java.util.List
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.util.UriComponentsBuilder
;
import
com.netflix.client.http.HttpRequest
;
import
com.netflix.client.http.HttpRequest.Builder
;
import
com.netflix.client.http.HttpRequest.Verb
;
...
...
@@ -35,7 +39,6 @@ import com.netflix.hystrix.HystrixCommandProperties.ExecutionIsolationStrategy;
import
com.netflix.niws.client.http.RestClient
;
import
com.netflix.zuul.constants.ZuulConstants
;
import
com.netflix.zuul.context.RequestContext
;
import
org.springframework.util.MultiValueMap
;
/**
* Hystrix wrapper around Eureka Ribbon command
...
...
@@ -77,7 +80,7 @@ public class RibbonCommand extends HystrixCommand<HttpResponse> {
super
(
getSetter
(
commandKey
));
this
.
restClient
=
restClient
;
this
.
verb
=
verb
;
this
.
uri
=
new
URI
(
uri
);
this
.
uri
=
(
StringUtils
.
hasText
(
uri
))?
UriComponentsBuilder
.
fromUriString
(
uri
).
build
().
toUri
()
:
new
URI
(
uri
);
this
.
retryable
=
retryable
;
this
.
headers
=
headers
;
this
.
params
=
params
;
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/SampleZuulProxyApplicationTests.java
View file @
bd5d00c0
...
...
@@ -132,6 +132,15 @@ public class SampleZuulProxyApplicationTests {
assertEquals
(
"Gotten 1!"
,
result
.
getBody
());
}
@Test
public
void
routeWithSpace
()
{
ResponseEntity
<
String
>
result
=
new
TestRestTemplate
().
exchange
(
"http://localhost:"
+
this
.
port
+
"/simple/spa ce"
,
HttpMethod
.
GET
,
new
HttpEntity
<>((
Void
)
null
),
String
.
class
);
assertEquals
(
HttpStatus
.
OK
,
result
.
getStatusCode
());
assertEquals
(
"Hello space"
,
result
.
getBody
());
}
}
// Don't use @SpringBootApplication because we don't want to component scan
...
...
@@ -169,6 +178,11 @@ class SampleZuulProxyApplication {
return
"Hello world"
;
}
@RequestMapping
(
"/spa ce"
)
public
String
space
()
{
return
"Hello space"
;
}
@Bean
public
ZuulFilter
sampleFilter
()
{
return
new
ZuulFilter
()
{
...
...
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