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-cmds
Commits
a29b26be
Commit
a29b26be
authored
Apr 29, 2020
by
Hector Sanjuan
Committed by
Steven Allen
Apr 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix go-ipfs#7242: Remove "HEAD" from Allow methods
(when GET is not allowed).
parent
90c723d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
http/errors_test.go
http/errors_test.go
+1
-1
http/handler.go
http/handler.go
+1
-1
No files found.
http/errors_test.go
View file @
a29b26be
...
...
@@ -165,7 +165,7 @@ func TestUnhandledMethod(t *testing.T) {
AllowGet
:
false
,
Code
:
http
.
StatusMethodNotAllowed
,
ResHeaders
:
map
[
string
]
string
{
"Allow"
:
"POST,
HEAD,
OPTIONS"
,
"Allow"
:
"POST, OPTIONS"
,
},
}
tc
.
test
(
t
)
...
...
http/handler.go
View file @
a29b26be
...
...
@@ -192,10 +192,10 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
func
setAllowedHeaders
(
w
http
.
ResponseWriter
,
allowGet
bool
)
{
w
.
Header
()
.
Add
(
"Allow"
,
http
.
MethodHead
)
w
.
Header
()
.
Add
(
"Allow"
,
http
.
MethodOptions
)
w
.
Header
()
.
Add
(
"Allow"
,
http
.
MethodPost
)
if
allowGet
{
w
.
Header
()
.
Add
(
"Allow"
,
http
.
MethodHead
)
w
.
Header
()
.
Add
(
"Allow"
,
http
.
MethodGet
)
}
}
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