diff options
author | 2020-11-11 19:18:31 -0500 | |
---|---|---|
committer | 2020-11-12 09:48:48 -0500 | |
commit | 10be5cfcdf61fd206746a713e7cb0aab22dd610b (patch) | |
tree | b119703a6925cf3ce2197478c7bd9525a7aa1b80 /ms/blueprintsprocessor/modules | |
parent | 8e36d74b1c2c3e2f3da71917e8acea7728525399 (diff) |
Remove URI encoding in BlueprintWebClientService
Malformed uri's should be handled by resource resolution in the cba
Issue-ID: CCSDK-2980
Change-Id: I5c1cf97519a882ff5cf99e9850c65df9ba6d9c36
Signed-off-by: Jozsef Csongvai <jozsef.csongvai@bell.ca>
Diffstat (limited to 'ms/blueprintsprocessor/modules')
2 files changed, 6 insertions, 22 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt index 11f6dc7e3..3c8d92c26 100644 --- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt +++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt @@ -42,11 +42,9 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintIOUtils import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.springframework.http.HttpHeaders import org.springframework.http.HttpMethod -import org.springframework.web.util.UriUtils import java.io.IOException import java.io.InputStream import java.nio.charset.Charset -import java.nio.charset.StandardCharsets interface BlueprintWebClientService { @@ -94,15 +92,14 @@ interface BlueprintWebClientService { * the difference is in convertToBasicHeaders vs basicHeaders */ val convertedHeaders: Array<BasicHeader> = convertToBasicHeaders(headers) - val encodedPath = UriUtils.encodeQuery(path, StandardCharsets.UTF_8.name()) return when (HttpMethod.resolve(methodType)) { - HttpMethod.DELETE -> delete(encodedPath, convertedHeaders, String::class.java) - HttpMethod.GET -> get(encodedPath, convertedHeaders, String::class.java) - HttpMethod.POST -> post(encodedPath, request, convertedHeaders, String::class.java) - HttpMethod.PUT -> put(encodedPath, request, convertedHeaders, String::class.java) - HttpMethod.PATCH -> patch(encodedPath, request, convertedHeaders, String::class.java) + HttpMethod.DELETE -> delete(path, convertedHeaders, String::class.java) + HttpMethod.GET -> get(path, convertedHeaders, String::class.java) + HttpMethod.POST -> post(path, request, convertedHeaders, String::class.java) + HttpMethod.PUT -> put(path, request, convertedHeaders, String::class.java) + HttpMethod.PATCH -> patch(path, request, convertedHeaders, String::class.java) else -> throw BluePrintProcessorException( - "Unsupported methodType($methodType) attempted on path($encodedPath)" + "Unsupported methodType($methodType) attempted on path($path)" ) } } diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientServiceTest.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientServiceTest.kt index 71f8cd753..ca9d9acbd 100644 --- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientServiceTest.kt +++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientServiceTest.kt @@ -130,19 +130,6 @@ class RestClientServiceTest { } @Test - fun testGetPathParamWithWhitespace() { - val restClientService = bluePrintRestLibPropertyService - .blueprintWebClientService("sample") - val response = restClientService.exchangeResource( - HttpMethod.GET.name, "/sample/path/id 3/get", "" - ) - assertEquals( - "path param id:id 3", response.body, - "failed to get query param response" - ) - } - - @Test fun testPatch() { val restClientService = bluePrintRestLibPropertyService .blueprintWebClientService("sample") |