Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
#35 Basic auth support (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreybratus authored May 13, 2020
1 parent a987fcd commit 5e14d8a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Connect tools is Maven
## Requirements

* Java 1.8
* Gradle 3
* Gradle 5

Kafka Connect CLI
=================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ object ScalajHttpClient extends HttpClient {
*/
def request(url: java.net.URI, method: String, headers: Seq[(String, String)], reqBody: Option[String]): Try[(Int, Option[String])] = {
try {
val r = Http(url.toString).headers(headers)
val r = (Option(url.getUserInfo).getOrElse("").split(":") match {
case Array(user, password) => Http(url.toString).auth(user, password)
case _ => Http(url.toString)
}).headers(headers)
(reqBody match {
case Some(body) => r.postData(body)
case None => r
Expand Down

0 comments on commit 5e14d8a

Please sign in to comment.