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
944ad1da
Commit
944ad1da
authored
Apr 29, 2020
by
Sawood Alam
Committed by
Steven Allen
Apr 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename setAllowedHeaders to setAllowHeader to better reflect the purpose
parent
f36ceb1e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
http/handler.go
http/handler.go
+3
-3
No files found.
http/handler.go
View file @
944ad1da
...
...
@@ -107,7 +107,7 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// The CORS library handles all other requests.
// Tell the user the allowed methods, and return.
setAllow
ed
Header
s
(
w
,
h
.
cfg
.
AllowGet
)
setAllowHeader
(
w
,
h
.
cfg
.
AllowGet
)
w
.
WriteHeader
(
http
.
StatusNoContent
)
return
case
http
.
MethodPost
:
...
...
@@ -117,7 +117,7 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
fallthrough
default
:
setAllow
ed
Header
s
(
w
,
h
.
cfg
.
AllowGet
)
setAllowHeader
(
w
,
h
.
cfg
.
AllowGet
)
http
.
Error
(
w
,
"405 - Method Not Allowed"
,
http
.
StatusMethodNotAllowed
)
log
.
Warnf
(
"The IPFS API does not support %s requests."
,
r
.
Method
)
return
...
...
@@ -192,7 +192,7 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h
.
root
.
Call
(
req
,
re
,
h
.
env
)
}
func
setAllow
ed
Header
s
(
w
http
.
ResponseWriter
,
allowGet
bool
)
{
func
setAllowHeader
(
w
http
.
ResponseWriter
,
allowGet
bool
)
{
allowedMethods
:=
[]
string
{
http
.
MethodOptions
,
http
.
MethodPost
}
if
allowGet
{
allowedMethods
=
append
(
allowedMethods
,
http
.
MethodHead
,
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