Hi Team, Can someone please help here?
I wanted to replace the response content with some value. Here is my code
def someRoute: Route = path(“ci” / “anomaly” / “detection” / “location” / Segment / Segment / “units” / IntNumber) { (country, businessUnit, store) =>
get {
extractRequest { req =>
val sbuUri = s” $ { someHost }/ci/anomaly/detection/location/ $ {country}/ $ {businessUnit}/units/ $ { storeMap .getOrElse(store, store).toString}"
onComplete( http .singleRequest(request = HttpRequest (uri = sbuUri, headers = req.headers))) {
case Success(resp) => complete(resp)
case Failure(ex) => complete((StatusCodes. InternalServerError , s"An error occurred: $ {ex.getMessage}"))
}
}
}
}
and I wanted to replace something like this
case Sucess(resp) => complete(resp.replace(“oneString”,“Other”))
How can I achieve this one in scala http one?