Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
91f20050
Commit
91f20050
authored
May 31, 2018
by
Ruben Cid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test YAML
parent
7c80bf6f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
router_test.go
router_test.go
+27
-0
No files found.
router_test.go
View file @
91f20050
...
...
@@ -695,3 +695,30 @@ func beegoResetParams(ctx *context.Context) {
func
beegoHandleResetParams
(
ctx
*
context
.
Context
)
{
ctx
.
ResponseWriter
.
Header
()
.
Set
(
"splat"
,
ctx
.
Input
.
Param
(
":splat"
))
}
// YAML
type
YAMLController
struct
{
Controller
}
func
(
jc
*
YAMLController
)
Prepare
()
{
jc
.
Data
[
"yaml"
]
=
"prepare"
jc
.
ServeYAML
()
}
func
(
jc
*
YAMLController
)
Get
()
{
jc
.
Data
[
"Username"
]
=
"astaxie"
jc
.
Ctx
.
Output
.
Body
([]
byte
(
"ok"
))
}
func
TestYAMLPrepare
(
t
*
testing
.
T
)
{
r
,
_
:=
http
.
NewRequest
(
"GET"
,
"/yaml/list"
,
nil
)
w
:=
httptest
.
NewRecorder
()
handler
:=
NewControllerRegister
()
handler
.
Add
(
"/yaml/list"
,
&
YAMLController
{})
handler
.
ServeHTTP
(
w
,
r
)
if
strings
.
TrimSpace
(
w
.
Body
.
String
())
!=
"prepare"
{
t
.
Errorf
(
w
.
Body
.
String
())
}
}
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