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
ae2e25f4
Commit
ae2e25f4
authored
Nov 26, 2013
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #316
parent
7b405e9a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
13 deletions
+25
-13
context.go
context/context.go
+7
-8
input.go
context/input.go
+18
-5
No files found.
context/context.go
View file @
ae2e25f4
package
context
import
(
"net/http"
"github.com/astaxie/beego/middleware"
"net/http"
)
type
Context
struct
{
...
...
@@ -22,12 +21,12 @@ func (ctx *Context) Abort(status int, body string) {
ctx
.
Output
.
SetStatus
(
status
)
ctx
.
Output
.
Body
([]
byte
(
body
))
if
e
,
ok
:=
middleware
.
HTTPExceptionMaps
[
status
];
ok
{
if
len
(
body
)
>=
1
{
e
.
Description
=
body
}
panic
(
e
)
}
if
e
,
ok
:=
middleware
.
HTTPExceptionMaps
[
status
];
ok
{
if
len
(
body
)
>=
1
{
e
.
Description
=
body
}
panic
(
e
)
}
}
func
(
ctx
*
Context
)
WriteString
(
content
string
)
{
...
...
context/input.go
View file @
ae2e25f4
...
...
@@ -11,15 +11,17 @@ import (
type
BeegoInput
struct
{
CruSession
session
.
SessionStore
Param
map
[
string
]
string
Params
map
[
string
]
string
Data
map
[
interface
{}]
interface
{}
req
*
http
.
Request
RequestBody
[]
byte
}
func
NewInput
(
req
*
http
.
Request
)
*
BeegoInput
{
return
&
BeegoInput
{
Param
:
make
(
map
[
string
]
string
),
req
:
req
,
Params
:
make
(
map
[
string
]
string
),
Data
:
make
(
map
[
interface
{}]
interface
{}),
req
:
req
,
}
}
...
...
@@ -129,8 +131,8 @@ func (input *BeegoInput) UserAgent() string {
return
input
.
Header
(
"User-Agent"
)
}
func
(
input
*
BeegoInput
)
Param
s
(
key
string
)
string
{
if
v
,
ok
:=
input
.
Param
[
key
];
ok
{
func
(
input
*
BeegoInput
)
Param
(
key
string
)
string
{
if
v
,
ok
:=
input
.
Param
s
[
key
];
ok
{
return
v
}
return
""
...
...
@@ -164,3 +166,14 @@ func (input *BeegoInput) Body() []byte {
input
.
RequestBody
=
requestbody
return
requestbody
}
func
(
input
*
BeegoInput
)
GetData
(
key
interface
{})
interface
{}
{
if
v
,
ok
:=
input
.
Data
[
key
];
ok
{
return
v
}
return
nil
}
func
(
input
*
BeegoInput
)
SetData
(
key
,
val
interface
{})
{
input
.
Data
[
key
]
=
val
}
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