question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cast to ResponseSpecificationImpl in RequestSpecificationImpl

See original GitHub issue

Hi @johanhaleby ,

in RequestSpecificationImpl, in the latest version, line 1153 is a cast of the responseSpecification to ResponseSpecificationImpl. even if the variable is defined as FilterableResponseSpecification. private FilterableResponseSpecification responseSpecification

def http = new RestAssuredHttpBuilder(responseSpecification as ResponseSpecificationImpl, requestHeaders, queryParameters, targetUri, assertionClosure, urlEncodingEnabled, config, requestSpecification.getHttpClient() as AbstractHttpClient, allowContentType, responseSpecification.rpr.defaultParser)

In order to keep clean the reference to FilterableResponseSpecification interface and to make RestAssuredHttpBuilder use the FilterableResponseSpecification, this interface should be extended with the method hasBodyAssertionsDefined().

I am prepared to make a PR for this, will this be ok for you ?

Thanks !

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
cliviucommented, Apr 1, 2022

Thank you so much, I will try it over the weekend.

0reactions
johanhalebycommented, Apr 6, 2022

@cliviu Great to hear, I’ll make a new release soon!

Read more comments on GitHub >

github_iconTop Results From Across the Web

io.restassured.internal.RestAssuredResponseOptionsImpl ...
classCastException:io.restassured.internal.RestAssuredResponseOptionsImpl cannot be cast to io.restassured.response.ResponseOptions.
Read more >
RequestSpecification (REST Assured 3.0.5 API) - Javadoc.io
All Known Implementing Classes: RequestSpecificationImpl ... Returns the response specification so that you can setup the expectations on the response.
Read more >
ValidatableResponseImpl cannot be cast to Response
ValidatableResponseImpl cannot be cast to io.restassured.response.Response . Does someone know what I'm doing wrong, and how I can fix this?
Read more >
Rest Assured - Avoid Duplicate code via RequestSpecification ...
In this video I've shown how to avoid duplicate code in Rest Assured using RequestSpecification and ResponseSpecification.
Read more >
How to perform REST API Testing using REST Assured
We also walked through the Test API code to better understand the implementation. In our next article, we will discuss the response part...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found