| 45 | } |
| 46 | |
| 47 | func Send(hashmap map[string]interface{}) (resp *req.Response) { |
| 48 | log.Debugln("send requesting") |
| 49 | method := hashmap["method"].(string) |
| 50 | url := hashmap["url"].(string) |
| 51 | proxy := hashmap["proxy"].(string) |
| 52 | retry := hashmap["retry"].(int) |
| 53 | timeout := hashmap["timeout"].(int) |
| 54 | mode := hashmap["mode"].(int) |
| 55 | headers := hashmap["headers"].(map[string]string) |
| 56 | body := hashmap["body"] |
| 57 | h1 := hashmap["h1"].(bool) |
| 58 | redirect := hashmap["redirect"].(bool) |
| 59 | |
| 60 | client := InIt(mode, timeout, proxy, retry, h1, redirect) |
| 61 | |
| 62 | //reqt := client.R().EnableDump() |
| 63 | reqt := client.R() |
| 64 | reqs := SetRequest(reqt, headers, body.(string)) |
| 65 | resp, errs := reqs.Send(method, url) |
| 66 | log.Debugln("send request success", resp.Dump()) |
| 67 | if resp == nil || errs != nil { |
| 68 | log.Debug("requesting error: " + errs.Error()) |
| 69 | if resp == nil { |
| 70 | log.Info("resp is nil") |
| 71 | } |
| 72 | return resp |
| 73 | } |
| 74 | |
| 75 | return resp |
| 76 | } |