Added documentation and tests for request.Meta

This commit is contained in:
Musab Gültekin
2021-05-30 10:43:54 +03:00
parent a2a91b7b2e
commit d3bdaf6240
3 changed files with 48 additions and 1 deletions

View File

@@ -229,6 +229,19 @@ func TestRobots(t *testing.T) {
}).Start()
}
func TestPassMetadata(t *testing.T) {
geziyor.NewGeziyor(&geziyor.Options{
StartRequestsFunc: func(g *geziyor.Geziyor) {
req, _ := client.NewRequest("GET", "https://httpbin.org/anything", nil)
req.Meta["key"] = "value"
g.Do(req, g.Opt.ParseFunc)
},
ParseFunc: func(g *geziyor.Geziyor, r *client.Response) {
assert.Equal(t, r.Request.Meta["key"], "value")
},
}).Start()
}
// Make sure to increase open file descriptor limits before running
func BenchmarkRequests(b *testing.B) {