Request creation simplified and basic auth test added.

This commit is contained in:
Musab Gültekin
2019-06-17 13:53:34 +03:00
parent a5ec28664d
commit 4177f10de9
4 changed files with 27 additions and 6 deletions

View File

@ -12,6 +12,7 @@ import (
"log"
"math/rand"
"net/http"
"net/http/cookiejar"
"os"
"runtime/debug"
"sync"
@ -49,7 +50,7 @@ func init() {
// If options provided, options
func NewGeziyor(opt *Options) *Geziyor {
geziyor := &Geziyor{
Client: internal.NewClient(opt.CookiesDisabled),
Client: internal.NewClient(),
Opt: opt,
Exports: make(chan interface{}),
requestMiddlewares: []RequestMiddleware{
@ -75,6 +76,9 @@ func NewGeziyor(opt *Options) *Geziyor {
if opt.Timeout != 0 {
geziyor.Client.Timeout = opt.Timeout
}
if !opt.CookiesDisabled {
geziyor.Client.Jar, _ = cookiejar.New(nil)
}
if opt.ConcurrentRequests != 0 {
geziyor.semGlobal = make(chan struct{}, opt.ConcurrentRequests)
}