artilleryio / artillery

The complete load testing platform. Everything you need for production-grade load tests. Serverless & distributed. Load test with Playwright. Load test HTTP APIs, GraphQL, WebSocket, and more. Use any Node.js module.
https://www.artillery.io
Mozilla Public License 2.0
7.92k stars 505 forks source link

Feature Request - Clear Accept-Encoding header when request has a capture section #924

Open asgerjensen opened 3 years ago

asgerjensen commented 3 years ago

Hi,

To be able to generate a workload that mimicks production as close as possible, i run my tests with

  defaults:
    think:
      jitter: 40%
    headers:
      Content-Type: application/json
      Accept: application/json
      Accept-Encoding: gzip

However, if a request has a capture section that will fail, because its being run on the compressed data stream. Only workaround I have found so far, is adding a request override to clear the headers.

      - post:
          beforeRequest: setAuthHeaders
          url:  /order
          headers:
            Accept-Encoding:
          json:
            outOrderName: "orderId"
          capture:
            - json: $.orderId
              as: orderNrOne

But, it seems like a trap. if you forget to set it, capture will not exactly fail and stop the virtual user, but rather continue with unmatched results.

Ideally, capture would check if the stream was compressed, and uncompress it before running the matchers, but failing that, it would be great if the request handler could automatically clear the Accept-Encoding header if it had a capture group.

hassy commented 3 years ago

Is that with Artillery 1.6 @asgerjensen? You're right, capture should be run on the decompressed response, so that sounds like a bug.

asgerjensen commented 3 years ago

yes, artillery 1.6