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

Fix class cast exception in RequestPrinter with byte[] body #1491

Merged
merged 2 commits into from Jun 10, 2022

Commits on Jul 23, 2021

  1. Reproduce class cast error in request printing with byte[] body

    Only happens if shouldPrettyPrint is false, otherwise the
    groovy code handles non-String bodies more gracefully.
    
    Exception is:
    
    java.lang.ClassCastException: class [B cannot be cast to class java.lang.String ([B and java.lang.String are in module java.base of loader 'bootstrap')
            at io.restassured.module.mockmvc.RequestLoggingTest.can_supply_byte_array_as_body_for_post(RequestLoggingTest.java:161)
    neiser committed Jul 23, 2021
    Copy the full SHA
    d5f4fef View commit details
    Browse the repository at this point in the history
  2. Fix class cast error in request printing with byte[] body

    Only happens if shouldPrettyPrint is false, otherwise the
    groovy code handles non-String bodies more gracefully.
    
    The test only checks if the body is [B@, as the hash of the object changes on every test run.
    
    Exception is:
    
    java.lang.ClassCastException: class [B cannot be cast to class java.lang.String ([B and java.lang.String are in module java.base of loader 'bootstrap')
            at io.restassured.module.mockmvc.RequestLoggingTest.can_supply_byte_array_as_body_for_post(RequestLoggingTest.java:161)
    neiser committed Jul 23, 2021
    Copy the full SHA
    93fdebd View commit details
    Browse the repository at this point in the history