add regular expression matching to --output-http-rewrite-url

I extended --output-http-rewrite-url to also accept regular expressions for matching.
pushed. does that work for you?

2014-10-28 18:24 GMT+01:00 Leonid Bugaev <notifications@github.com>:

> In settings_url_map_test.go:
>
> > @@ -25,3 +24,24 @@ func TestUrlRewriteMap(t *testing.T) {
> >  		t.Error("Request url should not have been rewritten, was")
> >  	}
> >  }
> > +
> > +func TestUrlRewriteMap_2(t *testing.T) {
> > +	var url string
> > +
> > +	rewrites := UrlRewriteMap{}
> > +
> > +	err := rewrites.Set("/v1/user/([^\\/]+)/ping:/v2/user/$1/ping")
> > +	if err != nil {
> > +		t.Error("Should not error on /v1/user/([^\\/]+)/ping:/v2/user/$1/ping")
> > +	}
> > +
> > +	url = "/v1/user/joe/ping"
>
> Pls also add tests that explicitly checks if rewrites.Rewrite(url) ==
> /v2/user/joe/ping
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/buger/gor/pull/127/files#r19487611>.
>