Skip to content

RestAssured.registerParser() not work when use ResponseBuilder to build a new Response #978

@hdgtz

Description

@hdgtz

Hi,

I'm using the following code to validate the response
RestAssured.registerParser("text/plain", Parser.JSON);
response = given().filter(new myFilter())
.spec(myrRequestSpec)
.when()
.post();
It`s,work fine;

then I build a new response with following code
newResponse = new ResponseBuilder().clone(response)
.setBody("something.....")
.build();
When I run this , the following error is thrown:

java.lang.IllegalStateException: Expected response body to be verified as JSON, HTML or XML but content-type 'text/plain' is not supported out of the box.
Try registering a custom parser using:
RestAssured.registerParser("text/plain", );

I do not know why.
Any suggestions or hints are very welcome.

thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions