fixes and improvements #55
@ -25,7 +25,7 @@ func TestCompile(t *testing.T) {
|
|||||||
segs: []segment{
|
segs: []segment{
|
||||||
literal(eof),
|
literal(eof),
|
||||||
},
|
},
|
||||||
ops: []int{int(utilities.OpLitPush), 0},
|
ops: []int{int(OpLitPush), 0},
|
||||||
pool: []string{""},
|
pool: []string{""},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -3,11 +3,8 @@ package router
|
|||||||
// download from https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/master/protoc-gen-grpc-gateway/httprule/parse.go
|
// download from https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/master/protoc-gen-grpc-gateway/httprule/parse.go
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/unistack-org/micro/v3/logger"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// InvalidTemplateError indicates that the path template is not valid.
|
// InvalidTemplateError indicates that the path template is not valid.
|
||||||
|
@ -4,7 +4,6 @@ package router
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
@ -135,10 +134,6 @@ func TestTokenize(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestParseSegments(t *testing.T) {
|
func TestParseSegments(t *testing.T) {
|
||||||
err := flag.Set("v", "3")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("failed to set flag: %v", err)
|
|
||||||
}
|
|
||||||
for _, spec := range []struct {
|
for _, spec := range []struct {
|
||||||
tokens []string
|
tokens []string
|
||||||
want []segment
|
want []segment
|
||||||
@ -298,10 +293,6 @@ func TestParseSegments(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestParseSegmentsWithErrors(t *testing.T) {
|
func TestParseSegmentsWithErrors(t *testing.T) {
|
||||||
err := flag.Set("v", "3")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("failed to set flag: %v", err)
|
|
||||||
}
|
|
||||||
for _, spec := range []struct {
|
for _, spec := range []struct {
|
||||||
tokens []string
|
tokens []string
|
||||||
}{
|
}{
|
||||||
|
@ -143,13 +143,12 @@ func NewPattern(version int, ops []int, pool []string, verb string) (Pattern, er
|
|||||||
typedOps = append(typedOps, op)
|
typedOps = append(typedOps, op)
|
||||||
}
|
}
|
||||||
return Pattern{
|
return Pattern{
|
||||||
ops: typedOps,
|
ops: typedOps,
|
||||||
pool: pool,
|
pool: pool,
|
||||||
vars: vars,
|
vars: vars,
|
||||||
stacksize: maxstack,
|
stacksize: maxstack,
|
||||||
tailLen: tailLen,
|
tailLen: tailLen,
|
||||||
verb: verb,
|
verb: verb,
|
||||||
assumeColonVerb: options.assumeColonVerb,
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user