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
35983b48
Commit
35983b48
authored
10 years ago
by
Matt Bell
Committed by
Juan Batiz-Benet
10 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/ipfs2: Made '/ipfs' handler return more accurate HTTP response codes, resolves #287
parent
897e0f86
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
cmd/ipfs2/ipfsHandler.go
cmd/ipfs2/ipfsHandler.go
+10
-1
No files found.
cmd/ipfs2/ipfsHandler.go
View file @
35983b48
...
...
@@ -4,11 +4,13 @@ import (
"io"
"net/http"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
mh
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multihash"
core
"github.com/jbenet/go-ipfs/core"
"github.com/jbenet/go-ipfs/importer"
dag
"github.com/jbenet/go-ipfs/merkledag"
"github.com/jbenet/go-ipfs/routing"
uio
"github.com/jbenet/go-ipfs/unixfs/io"
u
"github.com/jbenet/go-ipfs/util"
)
...
...
@@ -45,7 +47,14 @@ func (i *ipfsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
nd
,
err
:=
i
.
ResolvePath
(
path
)
if
err
!=
nil
{
w
.
WriteHeader
(
http
.
StatusInternalServerError
)
if
err
==
routing
.
ErrNotFound
{
w
.
WriteHeader
(
http
.
StatusNotFound
)
}
else
if
err
==
context
.
DeadlineExceeded
{
w
.
WriteHeader
(
http
.
StatusRequestTimeout
)
}
else
{
w
.
WriteHeader
(
http
.
StatusBadRequest
)
}
log
.
Error
(
err
)
w
.
Write
([]
byte
(
err
.
Error
()))
return
...
...
This diff is collapsed.
Click to expand it.
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