Skip to content

Commit

Permalink
Remove unused import
Browse files Browse the repository at this point in the history
  • Loading branch information
andersonkmi committed Feb 4, 2024
1 parent 8ff3182 commit 015de70
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/scala/org/codecraftlabs/spark/utils/RestUtils.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.codecraftlabs.spark.utils

import scala.io
import scala.io.Source

object RestUtils {
@throws(classOf[java.io.IOException])
Expand All @@ -11,14 +11,14 @@ object RestUtils {
requestMethod: String = "GET",
requestHeaders: Map[String, String] = Map()): String =
{
import java.net.{URL, HttpURLConnection}
import java.net.{HttpURLConnection, URL}
val connection = new URL(url).openConnection.asInstanceOf[HttpURLConnection]
requestHeaders.foreach(item => connection.setRequestProperty(item._1, item._2))
connection.setConnectTimeout(connectTimeout)
connection.setReadTimeout(readTimeout)
connection.setRequestMethod(requestMethod)
val inputStream = connection.getInputStream
val content = io.Source.fromInputStream(inputStream).mkString
val content = Source.fromInputStream(inputStream).mkString
if (inputStream != null) inputStream.close()
content
}
Expand Down

0 comments on commit 015de70

Please sign in to comment.