我可以用下面的代码让它工作
Map<String, Object> params = new HashMap<>();
params.put("emailId", "test@test.com");
params.put("password", "test123");
request = given().
log().all().
header("Host", HOST_HEADER).
header("user-agent", USER_AGENT).
header("accept", ACCEPT).
header("content-type", CONTENT_TYPE).
contentType(JSON).
body(params);
response = request.when().
post(ENDPOINT_FOR_LOGIN);
json = response.then().statusCode(200);
import static io.restassured.http.ContentType.JSON;
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
<scope>test</scope>
</dependency>