Skip to content

Commit

Permalink
fix: add url encoding to get endpoints (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil91 authored Apr 30, 2024
1 parent 4762a50 commit 3308287
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions charts/dim/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
apiVersion: v2
name: dim
type: application
version: 0.0.6
appVersion: 0.0.6
version: 0.0.7
appVersion: 0.0.7
description: Helm chart for DIM Middle Layer
home: https://github.com/catenax-ng/dim-repo
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion charts/dim/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ To use the helm chart as a dependency:
dependencies:
- name: dim
repository: https://phil91.github.io/dim-client
version: 0.0.6
version: 0.0.7
```
## Requirements
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>0.0.6</VersionPrefix>
<VersionPrefix>0.0.7</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
9 changes: 5 additions & 4 deletions src/clients/Dim.Clients/Api/Cf/CfClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using Org.Eclipse.TractusX.Portal.Backend.Framework.HttpClientExtensions;
using System.Net.Http.Json;
using System.Text.Json;
using System.Web;

namespace Dim.Clients.Api.Cf;

Expand Down Expand Up @@ -71,7 +72,7 @@ public async Task<Guid> CreateCloudFoundrySpace(string tenantName, CancellationT

private static async Task<Guid> GetEnvironmentId(string tenantName, CancellationToken cancellationToken, HttpClient client)
{
var environmentsResponse = await client.GetAsync($"/v3/organizations?names={tenantName}", cancellationToken)
var environmentsResponse = await client.GetAsync($"/v3/organizations?names={HttpUtility.UrlEncode(tenantName)}", cancellationToken)
.CatchingIntoServiceExceptionFor("get-organizations", HttpAsyncResponseMessageExtension.RecoverOptions.INFRASTRUCTURE);
var environments = await environmentsResponse.Content
.ReadFromJsonAsync<GetEnvironmentsResponse>(JsonSerializerExtensions.Options, cancellationToken)
Expand Down Expand Up @@ -136,7 +137,7 @@ public async Task<Guid> GetSpace(string tenantName, CancellationToken cancellati
{
var spaceName = $"{tenantName}-space";
var client = await _basicAuthTokenService.GetBasicAuthorizedLegacyClient<CfClient>(_settings, cancellationToken).ConfigureAwait(false);
var result = await client.GetAsync($"/v3/spaces?names={spaceName}", cancellationToken)
var result = await client.GetAsync($"/v3/spaces?names={HttpUtility.UrlEncode(spaceName)}", cancellationToken)
.CatchingIntoServiceExceptionFor("get-space", HttpAsyncResponseMessageExtension.RecoverOptions.ALLWAYS).ConfigureAwait(false);
try
{
Expand Down Expand Up @@ -182,7 +183,7 @@ private async Task<Guid> GetServiceInstances(string tenantName, Guid? spaceId, C
{
var name = $"{tenantName}-dim-instance";
var client = await _basicAuthTokenService.GetBasicAuthorizedLegacyClient<CfClient>(_settings, cancellationToken).ConfigureAwait(false);
var result = await client.GetAsync($"/v3/service_instances?names={name}", cancellationToken)
var result = await client.GetAsync($"/v3/service_instances?names={HttpUtility.UrlEncode(name)}", cancellationToken)
.CatchingIntoServiceExceptionFor("get-si", HttpAsyncResponseMessageExtension.RecoverOptions.INFRASTRUCTURE).ConfigureAwait(false);
try
{
Expand Down Expand Up @@ -226,7 +227,7 @@ public async Task<Guid> GetServiceBinding(string tenantName, Guid spaceId, strin
{
var client = await _basicAuthTokenService.GetBasicAuthorizedLegacyClient<CfClient>(_settings, cancellationToken).ConfigureAwait(false);
var serviceInstanceId = await GetServiceInstances(tenantName, spaceId, cancellationToken).ConfigureAwait(false);
var result = await client.GetAsync($"/v3/service_credential_bindings?names={bindingName}", cancellationToken)
var result = await client.GetAsync($"/v3/service_credential_bindings?names={HttpUtility.UrlEncode(bindingName)}", cancellationToken)
.CatchingIntoServiceExceptionFor("get-credential-binding", HttpAsyncResponseMessageExtension.RecoverOptions.INFRASTRUCTURE).ConfigureAwait(false);
try
{
Expand Down

0 comments on commit 3308287

Please sign in to comment.