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

Using --compressed option, bytes query use raw HTTP request body instead of decompressed body #563

Closed
jcamiel opened this issue May 9, 2022 · 0 comments · Fixed by #565
Labels
bug Something isn't working
Milestone

Comments

@jcamiel
Copy link
Collaborator

jcamiel commented May 9, 2022

Given this Hurl file:

GET http://localhost:8000/compressed/brotli
[Asserts]
body startsWith "Hello"

With this Flask endpoint (from integration):

@app.route("/compressed/brotli")
def compressed_brotli():
    assert "br" in request.headers["Accept-Encoding"]
    result = BytesIO()
    result.write(
        b"\x21\x2c\x00\x04\x48\x65\x6c\x6c\x6f\x20\x57\x6f\x72\x6c\x64\x21\x03"
    )
    data = result.getvalue()
    resp = make_response(data)
    resp.headers["Content-Encoding"] = "br"
    return resp

We can check that body query works on decompressed body when using --compressed option (as stated in the doc).

If we add a bytes query that check the binary representation of "Hello":

GET http://localhost:8000/compressed/brotli
[Asserts]
body startsWith "Hello"
bytes startsWith hex,48656c6c6f; # Hello in bytes 

Hurl fails with this message:

error: Assert Failure
  --> integration/tests_ok/compressed.hurl:10:0
   |
10 | bytes startsWith hex,48656c6c6f; # Hello in ascii
   |   actual:   byte array <212c000448656c6c6f20576f726c642103>
   |   expected: starts with byte array <48656c6c6f>
   |

We can see that the bytes assert is done on the raw HTTP body response.

@jcamiel jcamiel added the bug Something isn't working label May 9, 2022
@jcamiel jcamiel changed the title Using --compressed option, bytes query use raw HTTp request body instead of decompressed body Using --compressed option, bytes query use raw HTTP request body instead of decompressed body May 9, 2022
@jcamiel jcamiel linked a pull request May 10, 2022 that will close this issue
@fabricereix fabricereix added this to the 1.7.0 milestone Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants