in src_en/src/main/scala/services/DataServiceImpl.scala [20:38]
def dataOnPostRequest(fileUrl: String): Option[String] = {
val httpClient = HttpClients.createDefault()
val httpRequest: HttpPost = new HttpPost(ConfigFactory.load().getString("mdLink"))
httpRequest.setHeader("Content-type", "text/plain")
val test: StringEntity = new StringEntity(fileUrl)
httpRequest.setEntity(test)
val httpResponse: HttpResponse = httpClient.execute(httpRequest)
val responseBody: String = EntityUtils.toString(httpResponse.getEntity)
if (httpResponse.getStatusLine.toString.contains("OK")) {
logger.info(s"status : {${httpResponse.getStatusLine.toString.contains("OK")}}")
Some(responseBody.toString)
}
else {
logger.error(s"Fetching the file fails with the status {${httpResponse.getStatusLine}}")
None
}
}