Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
7b39bd70
authored
2014-08-22 16:43:42 +0800
by
jessonchan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
refactor
1 parent
01e40845
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
24 deletions
httplib/httplib.go
httplib/httplib.go
View file @
7b39bd7
...
...
@@ -73,49 +73,42 @@ func SetDefaultSetting(setting BeegoHttpSettings) {
}
}
// Get returns *BeegoHttpRequest with GET method.
func
Get
(
url
string
)
*
BeegoHttpRequest
{
var
req
http
.
Request
// return *BeegoHttpRequest with specific method
func
newBeegoRequest
(
url
,
method
string
)
*
BeegoHttpRequest
{
req
:=
http
.
Request
{
Proto
:
"HTTP/1.1"
,
ProtoMajor
:
1
,
ProtoMinor
:
1
,
}
var
resp
http
.
Response
req
.
Method
=
"GET"
req
.
Method
=
method
req
.
Header
=
http
.
Header
{}
return
&
BeegoHttpRequest
{
url
,
&
req
,
map
[
string
]
string
{},
map
[
string
]
string
{},
defaultSetting
,
&
resp
,
nil
}
}
// Get returns *BeegoHttpRequest with GET method.
func
Get
(
url
string
)
*
BeegoHttpRequest
{
return
newBeegoRequest
(
url
,
"GET"
)
}
// Post returns *BeegoHttpRequest with POST method.
func
Post
(
url
string
)
*
BeegoHttpRequest
{
var
req
http
.
Request
var
resp
http
.
Response
req
.
Method
=
"POST"
req
.
Header
=
http
.
Header
{}
return
&
BeegoHttpRequest
{
url
,
&
req
,
map
[
string
]
string
{},
map
[
string
]
string
{},
defaultSetting
,
&
resp
,
nil
}
return
newBeegoRequest
(
url
,
"POST"
)
}
// Put returns *BeegoHttpRequest with PUT method.
func
Put
(
url
string
)
*
BeegoHttpRequest
{
var
req
http
.
Request
var
resp
http
.
Response
req
.
Method
=
"PUT"
req
.
Header
=
http
.
Header
{}
return
&
BeegoHttpRequest
{
url
,
&
req
,
map
[
string
]
string
{},
map
[
string
]
string
{},
defaultSetting
,
&
resp
,
nil
}
return
newBeegoRequest
(
url
,
"PUT"
)
}
// Delete returns *BeegoHttpRequest DELETE GET method.
func
Delete
(
url
string
)
*
BeegoHttpRequest
{
var
req
http
.
Request
var
resp
http
.
Response
req
.
Method
=
"DELETE"
req
.
Header
=
http
.
Header
{}
return
&
BeegoHttpRequest
{
url
,
&
req
,
map
[
string
]
string
{},
map
[
string
]
string
{},
defaultSetting
,
&
resp
,
nil
}
return
newBeegoRequest
(
url
,
"DELETE"
)
}
// Head returns *BeegoHttpRequest with HEAD method.
func
Head
(
url
string
)
*
BeegoHttpRequest
{
var
req
http
.
Request
var
resp
http
.
Response
req
.
Method
=
"HEAD"
req
.
Header
=
http
.
Header
{}
return
&
BeegoHttpRequest
{
url
,
&
req
,
map
[
string
]
string
{},
map
[
string
]
string
{},
defaultSetting
,
&
resp
,
nil
}
return
newBeegoRequest
(
url
,
"HEAD"
)
}
// BeegoHttpSettings
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment