MCPcopy Create free account
hub / github.com/codesenberg/bombardier / newFastHTTPClient

Function newFastHTTPClient

clients.go:50–76  ·  view source on GitHub ↗
(opts *clientOpts)

Source from the content-addressed store, hash-verified

48}
49
50func newFastHTTPClient(opts *clientOpts) client {
51 c := new(fasthttpClient)
52 uri := fasthttp.AcquireURI()
53 if err := uri.Parse(
54 []byte(opts.requestURL.Host),
55 []byte(opts.requestURL.String()),
56 ); err != nil {
57 // opts.requestURL must always be valid
58 panic(err)
59 }
60 c.uri = uri
61 c.client = &fasthttp.Client{
62 MaxConnsPerHost: int(opts.maxConns),
63 ReadTimeout: opts.timeout,
64 WriteTimeout: opts.timeout,
65 DisableHeaderNamesNormalizing: true,
66 TLSConfig: opts.tlsConfig,
67 Dial: fasthttpDialFunc(
68 opts.bytesRead, opts.bytesWritten,
69 opts.timeout,
70 ),
71 }
72 c.headers = headersToFastHTTPHeaders(opts.headers)
73 c.method, c.body = opts.method, opts.body
74 c.bodProd = opts.bodProd
75 return client(c)
76}
77
78func (c *fasthttpClient) do() (
79 code int, usTaken uint64, err error,

Callers 2

TestHTTP1ClientsFunction · 0.85
makeHTTPClientFunction · 0.85

Calls 3

headersToFastHTTPHeadersFunction · 0.85
clientInterface · 0.85
StringMethod · 0.45

Tested by 1

TestHTTP1ClientsFunction · 0.68