Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
0097b422
Commit
0097b422
authored
Sep 20, 2016
by
Lars Gierth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gateway: use core api for serving POST requests
License: MIT Signed-off-by:
Lars Gierth
<
larsg@systemli.org
>
parent
c31e4f72
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
9 deletions
+3
-9
core/corehttp/gateway_handler.go
core/corehttp/gateway_handler.go
+3
-9
No files found.
core/corehttp/gateway_handler.go
View file @
0097b422
...
...
@@ -86,7 +86,7 @@ func (i *gatewayHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if
i
.
config
.
Writable
{
switch
r
.
Method
{
case
"POST"
:
i
.
postHandler
(
w
,
r
)
i
.
postHandler
(
ctx
,
w
,
r
)
return
case
"PUT"
:
i
.
putHandler
(
w
,
r
)
...
...
@@ -314,14 +314,8 @@ func (i *gatewayHandler) getOrHeadHandler(ctx context.Context, w http.ResponseWr
}
}
func
(
i
*
gatewayHandler
)
postHandler
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
nd
,
err
:=
i
.
newDagFromReader
(
r
.
Body
)
if
err
!=
nil
{
internalWebError
(
w
,
err
)
return
}
k
,
err
:=
i
.
node
.
DAG
.
Add
(
nd
)
func
(
i
*
gatewayHandler
)
postHandler
(
ctx
context
.
Context
,
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
k
,
err
:=
i
.
api
.
Add
(
ctx
,
r
.
Body
)
if
err
!=
nil
{
internalWebError
(
w
,
err
)
return
...
...
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