Skip to content
This repository was archived by the owner on Jan 9, 2020. It is now read-only.

Commit 0702e18

Browse files
mccheahash211
authored andcommitted
Remove leading slash from Retrofit interface. (#308)
1 parent d31d81a commit 0702e18

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/rest/kubernetes/ResourceStagingServiceRetrofit.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import org.apache.spark.deploy.kubernetes.submit.SubmittedResourceIdAndSecret
2929
private[spark] trait ResourceStagingServiceRetrofit {
3030

3131
@Multipart
32-
@retrofit2.http.POST("/api/v0/resources/")
32+
@retrofit2.http.POST("api/v0/resources/")
3333
def uploadResources(
3434
@retrofit2.http.Part("podLabels") podLabels: RequestBody,
3535
@retrofit2.http.Part("podNamespace") podNamespace: RequestBody,
@@ -38,7 +38,7 @@ private[spark] trait ResourceStagingServiceRetrofit {
3838
kubernetesCredentials: RequestBody): Call[SubmittedResourceIdAndSecret]
3939

4040
@Streaming
41-
@retrofit2.http.GET("/api/v0/resources/{resourceId}")
41+
@retrofit2.http.GET("api/v0/resources/{resourceId}")
4242
def downloadResources(
4343
@Path("resourceId") resourceId: String,
4444
@retrofit2.http.Header("Authorization") resourceSecret: String): Call[ResponseBody]

resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/rest/kubernetes/RetrofitClientFactory.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,13 @@ private[spark] object RetrofitClientFactoryImpl extends RetrofitClientFactory wi
8585
okHttpClientBuilder.sslSocketFactory(sslContext.getSocketFactory,
8686
trustManagers(0).asInstanceOf[X509TrustManager])
8787
}
88+
val resolvedBaseUrl = if (!baseUrl.endsWith("/")) {
89+
s"$baseUrl/"
90+
} else {
91+
baseUrl
92+
}
8893
new Retrofit.Builder()
89-
.baseUrl(baseUrl)
94+
.baseUrl(resolvedBaseUrl)
9095
.addConverterFactory(ScalarsConverterFactory.create())
9196
.addConverterFactory(JacksonConverterFactory.create(OBJECT_MAPPER))
9297
.client(okHttpClientBuilder.build())

0 commit comments

Comments
 (0)