|
|
@ -1,7 +1,6 @@
|
|
|
|
package pathvar
|
|
|
|
package pathvar
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"net/http"
|
|
|
|
"net/http"
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
"testing"
|
|
|
@ -16,7 +15,7 @@ func TestVars(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
r, err := http.NewRequest(http.MethodGet, "/", nil)
|
|
|
|
r, err := http.NewRequest(http.MethodGet, "/", nil)
|
|
|
|
assert.Nil(t, err)
|
|
|
|
assert.Nil(t, err)
|
|
|
|
r = r.WithContext(context.WithValue(context.Background(), pathVars, expect))
|
|
|
|
r = WithVars(r, expect)
|
|
|
|
assert.EqualValues(t, expect, Vars(r))
|
|
|
|
assert.EqualValues(t, expect, Vars(r))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|