나는 다음과 같은 테스트:
"fail if date is wrongly formatted" in {
val endpoint = s"/api/prof?date=wrongdate"
Get(endpoint) ~> check {
status shouldBe StatusCodes.BadRequest
val resp = responseAs[String]
resp shouldBe "could not be parsed"
}
}
그러나,테스트 실패하고 다음과 같다:
Could not unmarshal response to type 'java.lang.String' for `responseAs` assertion: akka.http.scaladsl.unmarshalling.Unmarshaller$UnsupportedContentTypeException: Unsupported Content-Type [Some(text/plain; charset=UTF-8)], supported: application/json
Response was: HttpResponse(400 Bad Request,List(),HttpEntity.Strict(text/plain; charset=UTF-8,106 bytes total),HttpProtocol(HTTP/1.1))
나는 어떻게 응답을 얻을 몸으로 문자열?