Skip to content

Commit

Permalink
Escape url disable flag
Browse files Browse the repository at this point in the history
  • Loading branch information
krystian-panek-vmltech committed Jul 1, 2021
1 parent 3bc9a93 commit 4d56f39
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ open class HttpClient(private val common: CommonExtension) {

val baseUrl = common.obj.string()

val escapeUrl = common.obj.boolean { convention(false) }

val basicUser = common.obj.string {
common.prop.string("httpClient.basicUser")?.let { set(it) }
}
Expand Down Expand Up @@ -363,7 +365,8 @@ open class HttpClient(private val common: CommonExtension) {
* https://stackoverflow.com/questions/13652681/httpclient-invalid-uri-escaped-absolute-path-not-valid
*/
open fun baseUrl(uri: String): String {
return "${baseUrl.orNull ?: ""}${UrlEscapers.urlFragmentEscaper().escape(uri)}"
val escapedUri = if (escapeUrl.get()) UrlEscapers.urlFragmentEscaper().escape(uri) else uri
return "${baseUrl.orNull ?: ""}$escapedUri"
}

@Suppress("TooGenericExceptionCaught")
Expand Down

0 comments on commit 4d56f39

Please sign in to comment.