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
dbef27ac
Commit
dbef27ac
authored
May 28, 2015
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more RibbonClient tests
parent
bd808a76
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
RibbonClientHttpRequestFactoryTests.java
...d/netflix/ribbon/RibbonClientHttpRequestFactoryTests.java
+20
-0
No files found.
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/RibbonClientHttpRequestFactoryTests.java
View file @
dbef27ac
...
@@ -86,6 +86,14 @@ public class RibbonClientHttpRequestFactoryTests {
...
@@ -86,6 +86,14 @@ public class RibbonClientHttpRequestFactoryTests {
}
}
@Test
@Test
public
void
requestWithEncodedPathParamWorks
()
{
ResponseEntity
<
String
>
response
=
restTemplate
.
getForEntity
(
"http://simple/path/{param}"
,
String
.
class
,
"world & everyone else"
);
assertEquals
(
"wrong response code"
,
HttpStatus
.
OK
,
response
.
getStatusCode
());
assertEquals
(
"wrong response body"
,
"hello world & everyone else"
,
response
.
getBody
());
}
@Test
public
void
requestWithRequestParamWorks
()
{
public
void
requestWithRequestParamWorks
()
{
ResponseEntity
<
String
>
response
=
restTemplate
.
getForEntity
(
"http://simple/request?param={param}"
,
String
.
class
,
"world"
);
ResponseEntity
<
String
>
response
=
restTemplate
.
getForEntity
(
"http://simple/request?param={param}"
,
String
.
class
,
"world"
);
assertEquals
(
"wrong response code"
,
HttpStatus
.
OK
,
response
.
getStatusCode
());
assertEquals
(
"wrong response code"
,
HttpStatus
.
OK
,
response
.
getStatusCode
());
...
@@ -100,6 +108,13 @@ public class RibbonClientHttpRequestFactoryTests {
...
@@ -100,6 +108,13 @@ public class RibbonClientHttpRequestFactoryTests {
}
}
@Test
@Test
public
void
requestWithEmptyPostWorks
()
{
ResponseEntity
<
String
>
response
=
restTemplate
.
postForEntity
(
"http://simple/emptypost"
,
""
,
String
.
class
);
assertEquals
(
"wrong response code"
,
HttpStatus
.
OK
,
response
.
getStatusCode
());
assertEquals
(
"wrong response body"
,
"hello empty"
,
response
.
getBody
());
}
@Test
@SneakyThrows
@SneakyThrows
public
void
requestWithHeaderWorks
()
{
public
void
requestWithHeaderWorks
()
{
RequestEntity
<
Void
>
entity
=
RequestEntity
.
get
(
new
URI
(
"http://simple/header"
))
RequestEntity
<
Void
>
entity
=
RequestEntity
.
get
(
new
URI
(
"http://simple/header"
))
...
@@ -136,6 +151,11 @@ public class RibbonClientHttpRequestFactoryTests {
...
@@ -136,6 +151,11 @@ public class RibbonClientHttpRequestFactoryTests {
return
"hello "
+
param
;
return
"hello "
+
param
;
}
}
@RequestMapping
(
value
=
"/emptypost"
,
method
=
RequestMethod
.
POST
)
public
String
hiPostEmpty
()
{
return
"hello empty"
;
}
@RequestMapping
(
"/header"
)
@RequestMapping
(
"/header"
)
public
String
hiHeader
(
@RequestHeader
(
"X-Param"
)
String
param
)
{
public
String
hiHeader
(
@RequestHeader
(
"X-Param"
)
String
param
)
{
return
"hello "
+
param
;
return
"hello "
+
param
;
...
...
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