Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clients: Fix request with headers set #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gruas
Copy link

@gruas gruas commented Sep 20, 2023

bombardier was failing to connect to the server if custom headers were set. This happened because the Host header was being overwritten during request creation. By reordering the operations (first set the headers, then the Host header) we can avoid this problem.

Example problem:

$ go run . -H 'Content-Type: application/json' -m POST http://localhost:8000/anything -p r -t 1s -n 1
Statistics        Avg      Stdev        Max
  Reqs/sec      1372.12       0.00    1372.12
  Latency       10.00us     0.00us    10.00us
  HTTP codes:
    1xx - 0, 2xx - 0, 3xx - 0, 4xx - 0, 5xx - 0
    others - 1
  Errors:
    dial tcp: missing address - 1
  Throughput:       0.00/s

bombardier was failing to connect to the server if custom headers were
set. This happened because the `Host` header was being overwritten
during request creation. By reordering the operations (first set the
headers, then the Host header) we can avoid this problem.
codesenberg added a commit that referenced this pull request Oct 30, 2023
Type of url field in config struct was changed from string to net/url.URL.
The way fasthttpClient is setup was adjusted to resolve the issue mentioned in #105.
Dial function used by fasthttp client was adjusted to respect --timeout
flag, which should fix #103.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant