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

HTTP headers in results produce invalid JSON #505

Closed
willgorman opened this issue Mar 23, 2020 · 2 comments · Fixed by #506
Closed

HTTP headers in results produce invalid JSON #505

willgorman opened this issue Mar 23, 2020 · 2 comments · Fixed by #506

Comments

@willgorman
Copy link

Version and Runtime

Version: 12.8.1
Commit: 19b7458
Runtime: go1.14 darwin/amd64
Date: 2020-03-18T23:14:26Z

Expected Behaviour

I expected to be able to use jq to process JSON formatted vegeta results:
echo 'GET http://httpbin.org/get' | vegeta attack -rate=1 -duration=1s | vegeta encode" | jq

{
  "attack": "",
  "seq": 0,
  "code": 200,
  "timestamp": "2020-03-23T22:55:59.3708787Z",
  "latency": 293490600,
  "bytes_out": 0,
  "bytes_in": 271,
  "error": "",
  "body": "..."
}

Actual Behaviour

echo "GET http://httpbin.org/get" | vegeta attack -rate=1 -duration=1s | vegeta encode | jq  
parse error: Expected separator between values at line 1, column 655

Steps to Reproduce

  1. echo "GET http://httpbin.org/get" | vegeta attack -rate=1 -duration=1s | vegeta encode

This produces output like

{"attack":"","seq":0,"code":200,"timestamp":"2020-03-23T17:58:33.347828102-05:00","latency":291316215,"bytes_out":0,"bytes_in":297,"error":"","body":"...","method":"GET","url":"http://httpbin.org/get","headers":[{"key":"Server","value":"gunicorn/19.9.0"}{"key":"Access-Control-Allow-Origin","value":"*"}{"key":"Access-Control-Allow-Credentials","value":"true"}{"key":"Date","value":"Mon, 23 Mar 2020 22:58:33 GMT"}{"key":"Content-Type","value":"application/json"}{"key":"Content-Length","value":"297"}{"key":"Connection","value":"keep-alive"}]}

The objects in the headers array are missing commas between them.

Additional Context

@tsenart
Copy link
Owner

tsenart commented Mar 24, 2020

@willgorman: Please test the latest release: https://github.com/tsenart/vegeta/releases/tag/v12.8.2

@willgorman
Copy link
Author

@tsenart 12.8.2 works as expected, thanks for the quick fix!

tsenart added a commit that referenced this issue Mar 25, 2020

Verified

This commit was signed with the committer’s verified signature.
This commits reverts #506 because its JSON string escaping logic taken
from github.com/valyala/quicktemplate isn't complete and is incompatible
with `encoding/json`. The performance gains do not justify this short
coming (at least for Vegeta). We fix the #505 by re-generating the
easyjson encoders.
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 a pull request may close this issue.

2 participants