Skip to content

Commit 97cf242

Browse files
authored
chore: add more tests (#3888)
1 parent 786a801 commit 97cf242

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

rest/httpx/requests_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,18 @@ func TestParseWithFloatPtr(t *testing.T) {
410410
})
411411
}
412412

413+
func TestParseWithEscapedParams(t *testing.T) {
414+
t.Run("escaped", func(t *testing.T) {
415+
var v struct {
416+
Dev string `form:"dev"`
417+
}
418+
r := httptest.NewRequest(http.MethodGet, "http://127.0.0.1/api/v2/dev/test?dev=se205%5fy1205%5fj109%26verRelease=v01%26iid1=863494061186673%26iid2=863494061186681%26mcc=636%26mnc=1", http.NoBody)
419+
if assert.NoError(t, Parse(r, &v)) {
420+
assert.Equal(t, "se205_y1205_j109&verRelease=v01&iid1=863494061186673&iid2=863494061186681&mcc=636&mnc=1", v.Dev)
421+
}
422+
})
423+
}
424+
413425
func BenchmarkParseRaw(b *testing.B) {
414426
r, err := http.NewRequest(http.MethodGet, "http://hello.com/a?name=hello&age=18&percent=3.4", http.NoBody)
415427
if err != nil {

0 commit comments

Comments
 (0)