File tree 1 file changed +10
-2
lines changed
internal/cmd/generate/commands/gentests
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -195,8 +195,10 @@ func (g *Generator) genFileHeader() {
195
195
import (
196
196
encjson "encoding/json"
197
197
encyaml "gopkg.in/yaml.v2"
198
+ "fmt"
198
199
"context"
199
200
"crypto/tls"
201
+ "net/url"
200
202
"testing"
201
203
"time"
202
204
@@ -206,10 +208,11 @@ import (
206
208
207
209
var (
208
210
// Prevent compilation errors for unused packages
211
+ _ = fmt.Printf
209
212
_ = encjson.NewDecoder
210
213
_ = encyaml.NewDecoder
211
214
_ = tls.Certificate{}
212
- _ = fmt.Printf
215
+ _ = url.QueryEscape
213
216
)` + "\n " )
214
217
}
215
218
@@ -957,7 +960,12 @@ func (g *Generator) genAction(a Action, skipBody ...bool) {
957
960
}
958
961
value = fmt .Sprintf ("%d" , dur .Nanoseconds ())
959
962
default :
960
- value = fmt .Sprintf ("%q" , v )
963
+ if strings .HasSuffix (k , "ID" ) {
964
+ value = fmt .Sprintf ("url.QueryEscape(%q)" , v )
965
+ } else {
966
+ value = fmt .Sprintf ("%q" , v )
967
+ }
968
+
961
969
}
962
970
}
963
971
g .w (value )
You can’t perform that action at this time.
0 commit comments