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
cf963724
Unverified
Commit
cf963724
authored
Sep 12, 2018
by
Steven Allen
Committed by
GitHub
Sep 12, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5433 from ipfs/test/gateway-options
improve gateway options test
parents
7ad12bf0
eabd6a0a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
core/corehttp/gateway_test.go
core/corehttp/gateway_test.go
+18
-1
No files found.
core/corehttp/gateway_test.go
View file @
cf963724
...
...
@@ -128,9 +128,9 @@ func newTestServerAndNode(t *testing.T, ns mockNamesys) (*httptest.Server, *core
dh
.
Handler
,
err
=
makeHandler
(
n
,
ts
.
Listener
,
VersionOption
(),
IPNSHostnameOption
(),
GatewayOption
(
false
,
"/ipfs"
,
"/ipns"
),
VersionOption
(),
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -290,6 +290,23 @@ func TestIPNSHostnameRedirect(t *testing.T) {
}
else
if
hdr
[
0
]
!=
"/good-prefix/foo/"
{
t
.
Errorf
(
"location header is %v, expected /good-prefix/foo/"
,
hdr
[
0
])
}
// make sure /version isn't exposed
req
,
err
=
http
.
NewRequest
(
"GET"
,
ts
.
URL
+
"/version"
,
nil
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
req
.
Host
=
"example.net"
req
.
Header
.
Set
(
"X-Ipfs-Gateway-Prefix"
,
"/good-prefix"
)
res
,
err
=
doWithoutRedirect
(
req
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
res
.
StatusCode
!=
404
{
t
.
Fatalf
(
"expected a 404 error, got: %s"
,
res
.
Status
)
}
}
func
TestIPNSHostnameBacklinks
(
t
*
testing
.
T
)
{
...
...
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