Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
caddy
Commits
9ca87cd1
Commit
9ca87cd1
authored
Jun 21, 2016
by
Abiola Ibrahim
Committed by
GitHub
Jun 21, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #898 from abiosoft/master
Fix missed if_op refactor. Ensure with tests.
parents
e585a741
cad9b3f6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
caddyhttp/httpserver/condition.go
caddyhttp/httpserver/condition.go
+2
-2
caddyhttp/httpserver/condition_test.go
caddyhttp/httpserver/condition_test.go
+21
-0
No files found.
caddyhttp/httpserver/condition.go
View file @
9ca87cd1
...
...
@@ -9,7 +9,7 @@ import (
"github.com/mholt/caddy/caddyfile"
)
// SetupIfMatcher parses `if` or `if_
type
` in the current dispenser block.
// SetupIfMatcher parses `if` or `if_
op
` in the current dispenser block.
// It returns a RequestMatcher and an error if any.
func
SetupIfMatcher
(
c
caddyfile
.
Dispenser
)
(
RequestMatcher
,
error
)
{
var
matcher
IfMatcher
...
...
@@ -195,5 +195,5 @@ func (m IfMatcher) Or(r *http.Request) bool {
// IfMatcherKeyword returns if k is a keyword for 'if' config block.
func
IfMatcherKeyword
(
k
string
)
bool
{
return
k
==
"if"
||
k
==
"if_
cond
"
return
k
==
"if"
||
k
==
"if_
op
"
}
caddyhttp/httpserver/condition_test.go
View file @
9ca87cd1
...
...
@@ -263,3 +263,24 @@ func TestSetupIfMatcher(t *testing.T) {
}
}
}
func
TestIfMatcherKeyword
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
keyword
string
expected
bool
}{
{
"if"
,
true
},
{
"ifs"
,
false
},
{
"tls"
,
false
},
{
"http"
,
false
},
{
"if_op"
,
true
},
{
"if_type"
,
false
},
{
"if_cond"
,
false
},
}
for
i
,
test
:=
range
tests
{
valid
:=
IfMatcherKeyword
(
test
.
keyword
)
if
valid
!=
test
.
expected
{
t
.
Errorf
(
"Test %d: expected %v found %v"
,
i
,
test
.
expected
,
valid
)
}
}
}
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