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
d20926f4
Commit
d20926f4
authored
Mar 17, 2015
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #932 from andyleap/gateway404
Fixes issue #924
parents
bcc8880a
512171aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
10 deletions
+2
-10
core/corehttp/gateway_handler.go
core/corehttp/gateway_handler.go
+1
-9
core/corehttp/gateway_test.go
core/corehttp/gateway_test.go
+1
-1
No files found.
core/corehttp/gateway_handler.go
View file @
d20926f4
...
...
@@ -174,15 +174,7 @@ func (i *gatewayHandler) getHandler(w http.ResponseWriter, r *http.Request) {
nd
,
p
,
err
:=
i
.
ResolvePath
(
ctx
,
urlPath
)
if
err
!=
nil
{
if
err
==
routing
.
ErrNotFound
{
w
.
WriteHeader
(
http
.
StatusNotFound
)
}
else
if
err
==
context
.
DeadlineExceeded
{
w
.
WriteHeader
(
http
.
StatusRequestTimeout
)
}
else
{
w
.
WriteHeader
(
http
.
StatusBadRequest
)
}
w
.
Write
([]
byte
(
err
.
Error
()))
webError
(
w
,
"Path Resolve error"
,
err
,
http
.
StatusBadRequest
)
return
}
...
...
core/corehttp/gateway_test.go
View file @
d20926f4
...
...
@@ -91,7 +91,7 @@ func TestGatewayGet(t *testing.T) {
{
"localhost:5001"
,
"/"
,
http
.
StatusNotFound
,
"404 page not found
\n
"
},
{
"localhost:5001"
,
"/"
+
k
,
http
.
StatusNotFound
,
"404 page not found
\n
"
},
{
"localhost:5001"
,
"/ipfs/"
+
k
,
http
.
StatusOK
,
"fnord"
},
{
"localhost:5001"
,
"/ipns/nxdomain.example.com"
,
http
.
StatusBadRequest
,
namesys
.
ErrResolveFailed
.
Error
()},
{
"localhost:5001"
,
"/ipns/nxdomain.example.com"
,
http
.
StatusBadRequest
,
"Path Resolve error: "
+
namesys
.
ErrResolveFailed
.
Error
()},
{
"localhost:5001"
,
"/ipns/example.com"
,
http
.
StatusOK
,
"fnord"
},
{
"example.com"
,
"/"
,
http
.
StatusOK
,
"fnord"
},
}
{
...
...
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