Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(retrofit): remove all com.squareup.okhttp dependencies #1845

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions gate-core/gate-core.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ dependencies {
implementation "io.spinnaker.kork:kork-plugins"
implementation "com.jakewharton.retrofit:retrofit1-okhttp3-client:1.1.0"
implementation "com.squareup.retrofit:converter-jackson"
implementation "com.squareup.okhttp:okhttp"
implementation "com.squareup.okhttp:okhttp-urlconnection"
implementation "com.squareup.okhttp:okhttp-apache"

implementation "io.spinnaker.fiat:fiat-api:$fiatVersion"
implementation "io.spinnaker.fiat:fiat-core:$fiatVersion"
Expand Down
1 change: 0 additions & 1 deletion gate-proxy/gate-proxy.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ dependencies {
implementation "io.spinnaker.kork:kork-exceptions"
implementation "io.spinnaker.kork:kork-web"
implementation "com.squareup.retrofit:retrofit"
implementation "com.squareup.okhttp:okhttp"
implementation "com.netflix.spectator:spectator-api"
implementation "com.google.guava:guava"
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import com.netflix.spinnaker.kork.annotations.Alpha
import com.netflix.spinnaker.kork.exceptions.SpinnakerException
import com.netflix.spinnaker.kork.exceptions.SystemException
import com.netflix.spinnaker.kork.web.exceptions.NotFoundException
import com.squareup.okhttp.internal.http.HttpMethod
import okhttp3.internal.http.HttpMethod
import org.springframework.beans.factory.ObjectProvider
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.http.HttpStatus
Expand Down Expand Up @@ -74,10 +74,11 @@ class ApiExtensionController @Autowired constructor(private val apiExtensionsPro

if (HttpMethod.permitsRequestBody(httpRequest.method)) {
try {
httpRequest.body = httpServletRequest
.reader
.lines()
.collect(Collectors.joining(System.lineSeparator()))
httpRequest.body = if (httpServletRequest.contentLength > 0) {
httpServletRequest.reader.readText()
} else {
""
}
} catch (e: IOException) {
throw SpinnakerException("Unable to read request body", e)
}
Expand Down
6 changes: 1 addition & 5 deletions gate-web/gate-web.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ dependencies {
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310"

implementation "com.squareup.okhttp:okhttp"
implementation "com.squareup.okhttp:okhttp-urlconnection"
implementation "com.squareup.okhttp:okhttp-apache"

implementation "io.spinnaker.fiat:fiat-core:$fiatVersion"
implementation "io.spinnaker.fiat:fiat-api:$fiatVersion"

Expand Down Expand Up @@ -69,7 +65,7 @@ dependencies {
testImplementation project(":gate-basic")
testImplementation project(":gate-oauth2")
testImplementation "com.github.tomakehurst:wiremock-jre8-standalone"
testImplementation "com.squareup.okhttp:mockwebserver"
testImplementation "com.squareup.okhttp3:mockwebserver"

testImplementation "com.squareup.retrofit:retrofit-mock"
testImplementation "org.springframework.security:spring-security-test"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import com.netflix.spinnaker.gate.services.ApplicationService
import com.netflix.spinnaker.gate.services.internal.ClouddriverService
import com.netflix.spinnaker.gate.services.internal.ClouddriverServiceSelector
import com.netflix.spinnaker.gate.services.internal.Front50Service
import com.squareup.okhttp.mockwebserver.MockWebServer
import okhttp3.mockwebserver.MockWebServer
import org.springframework.http.MediaType
import org.springframework.test.web.servlet.MockMvc
import org.springframework.test.web.servlet.setup.MockMvcBuilders
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package com.netflix.spinnaker.gate.controllers

import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.spinnaker.gate.services.internal.IgorService
import com.squareup.okhttp.mockwebserver.MockWebServer
import okhttp3.mockwebserver.MockWebServer
import org.springframework.http.MediaType
import org.springframework.mock.web.MockHttpServletResponse
import org.springframework.test.web.servlet.MockMvc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package com.netflix.spinnaker.gate.controllers

import com.netflix.spinnaker.gate.services.BuildService
import com.netflix.spinnaker.gate.services.internal.IgorService
import com.squareup.okhttp.mockwebserver.MockWebServer
import groovy.json.JsonSlurper
import okhttp3.mockwebserver.MockWebServer
import org.springframework.http.MediaType
import org.springframework.mock.web.MockHttpServletResponse
import org.springframework.test.web.servlet.MockMvc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ package com.netflix.spinnaker.gate.controllers
import com.netflix.spinnaker.gate.services.EcsClusterService
import com.netflix.spinnaker.gate.controllers.ecs.EcsClusterController
import com.netflix.spinnaker.gate.services.internal.ClouddriverService
import com.squareup.okhttp.mockwebserver.MockWebServer
import groovy.json.JsonSlurper
import okhttp3.mockwebserver.MockWebServer
import org.springframework.http.MediaType
import org.springframework.mock.web.MockHttpServletResponse
import org.springframework.test.web.servlet.MockMvc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import com.netflix.spinnaker.gate.services.BuildService
import com.netflix.spinnaker.gate.services.internal.GoogleCloudBuildTrigger
import com.netflix.spinnaker.gate.services.internal.IgorService
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerServerException
import com.squareup.okhttp.mockwebserver.MockWebServer
import okhttp3.mockwebserver.MockWebServer
import org.springframework.http.MediaType
import org.springframework.mock.web.MockHttpServletResponse
import org.springframework.test.web.servlet.MockMvc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import com.jakewharton.retrofit.Ok3Client
import com.netflix.spinnaker.gate.services.WebhookService
import com.netflix.spinnaker.gate.services.internal.EchoService
import com.netflix.spinnaker.gate.services.internal.OrcaServiceSelector
import com.squareup.okhttp.mockwebserver.MockWebServer
import io.cloudevents.spring.mvc.CloudEventHttpMessageConverter
import okhttp3.mockwebserver.MockWebServer
import org.springframework.http.HttpHeaders
import org.springframework.http.MediaType
import org.springframework.mock.web.MockHttpServletResponse
Expand Down