Added documentation and tests for request.Meta
This commit is contained in:
22
README.md
22
README.md
@@ -107,7 +107,7 @@ geziyor.NewGeziyor(&geziyor.Options{
|
||||
},
|
||||
//BrowserEndpoint: "ws://localhost:3000",
|
||||
}).Start()
|
||||
```
|
||||
```
|
||||
|
||||
### Extracting Data
|
||||
|
||||
@@ -147,6 +147,26 @@ geziyor.NewGeziyor(&geziyor.Options{
|
||||
}).Start()
|
||||
```
|
||||
|
||||
|
||||
### Custom Requests - Passing Metadata To Callbacks
|
||||
|
||||
You can create custom requests with ```client.NewRequest```
|
||||
|
||||
Use that request on ```geziyor.Do(request, callback)```
|
||||
|
||||
```go
|
||||
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) {
|
||||
fmt.Println("This is our data from request: ", r.Request.Meta["key"])
|
||||
},
|
||||
}).Start()
|
||||
```
|
||||
|
||||
## Benchmark
|
||||
|
||||
**8748 request per seconds** on *Macbook Pro 15" 2016*
|
||||
|
||||
Reference in New Issue
Block a user