Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
4326790b
Commit
4326790b
authored
Sep 20, 2017
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug: enable HEAD requests again
ref #9307
parent
4a6da233
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletions
+20
-1
pkg/api/route_register.go
+9
-1
pkg/api/route_register_test.go
+11
-0
No files found.
pkg/api/route_register.go
View file @
4326790b
...
...
@@ -8,6 +8,7 @@ import (
type
Router
interface
{
Handle
(
method
,
pattern
string
,
handlers
[]
macaron
.
Handler
)
*
macaron
.
Route
Get
(
pattern
string
,
handlers
...
macaron
.
Handler
)
*
macaron
.
Route
}
type
RouteRegister
interface
{
...
...
@@ -62,7 +63,14 @@ func (rr *routeRegister) Group(pattern string, fn func(rr RouteRegister), handle
func
(
rr
*
routeRegister
)
Register
(
router
Router
)
*
macaron
.
Router
{
for
_
,
r
:=
range
rr
.
routes
{
router
.
Handle
(
r
.
method
,
r
.
pattern
,
r
.
handlers
)
// GET requests have to be added to macaron routing using Get()
// Otherwise HEAD requests will not be allowed.
// https://github.com/go-macaron/macaron/blob/a325110f8b392bce3e5cdeb8c44bf98078ada3be/router.go#L198
if
r
.
method
==
http
.
MethodGet
{
router
.
Get
(
r
.
pattern
,
r
.
handlers
...
)
}
else
{
router
.
Handle
(
r
.
method
,
r
.
pattern
,
r
.
handlers
)
}
}
for
_
,
g
:=
range
rr
.
groups
{
...
...
pkg/api/route_register_test.go
View file @
4326790b
package
api
import
(
"net/http"
"strconv"
"testing"
...
...
@@ -21,6 +22,16 @@ func (fr *fakeRouter) Handle(method, pattern string, handlers []macaron.Handler)
return
&
macaron
.
Route
{}
}
func
(
fr
*
fakeRouter
)
Get
(
pattern
string
,
handlers
...
macaron
.
Handler
)
*
macaron
.
Route
{
fr
.
route
=
append
(
fr
.
route
,
route
{
pattern
:
pattern
,
method
:
http
.
MethodGet
,
handlers
:
handlers
,
})
return
&
macaron
.
Route
{}
}
func
emptyHandlers
(
n
int
)
[]
macaron
.
Handler
{
res
:=
[]
macaron
.
Handler
{}
for
i
:=
1
;
n
>=
i
;
i
++
{
...
...
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