How to resolve java.lang.java.lang.NoSuchFieldError:DEF_CONTENT_CHARSET in rest assured? -
i beginner, , trying check response given url. have written simple code, recieving exception. have tried lot of things, have not been able resolve it. please me.
code:
public class restapitest { @test public void test() { final string url = "http//:127.0.0.1:8080/myproject/api/"; given().parameter("header_name", "x-auth-token", "my_default_token", "_my_rest_token"). contenttype("application/json; charset=utf-16").when().get(url).then().statuscode(200); } }
exception occured:
java.lang.nosuchfielderror: def_content_charset @ com.jayway.restassured.config.encoderconfig.<init>(encoderconfig.java:48) @ com.jayway.restassured.config.restassuredconfig.<init>(restassuredconfig.java:41) @ com.jayway.restassured.restassured.<clinit>(restassured.java:423) @ com.rest.restapitest.test(restapitest.java:59)
it seems dependency issue. see this thread on official issues tracker.
i had same error , solved changing httpcore
version. library in classpath, downloaded global dependency version 4.0.1. guess minimal requirement 4.4.x.
in project settings, removed version 4.0.1 of httpcore
. downloaded version 4.4.6 using maven , added project.
Comments
Post a Comment