rakyll / hey

HTTP load generator, ApacheBench (ab) replacement
Apache License 2.0
17.65k stars 1.17k forks source link

Can hey send by go code ? #215

Open edfeff opened 3 years ago

edfeff commented 3 years ago

I want to mock some complex data to test my application. But I don't know how use hey to do this.

vniche commented 3 years ago

@edfeff , if you check hey.go, it uses the requester package to do the job, you can do something similar:

        w := &requester.Work{
        Request:            req,
        RequestBody:        bodyAll,
        N:                  num,
        C:                  conc,
        QPS:                q,
        Timeout:            *t,
        DisableCompression: *disableCompression,
        DisableKeepAlives:  *disableKeepAlives,
        DisableRedirects:   *disableRedirects,
        H2:                 *h2,
        ProxyAddr:          proxyURL,
        Output:             *output,
    }
    w.Init()