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

Trailing Slash in api url leads to failure in cf curl #2591

Open
OliverMautschke opened this issue Sep 29, 2023 · 0 comments
Open

Trailing Slash in api url leads to failure in cf curl #2591

OliverMautschke opened this issue Sep 29, 2023 · 0 comments

Comments

@OliverMautschke
Copy link

OliverMautschke commented Sep 29, 2023

Hello,

I discovered the following unexpected behaviour when using the cf curl command.

Everything works as expected, when logging in the following way:

cf api <the_api_url>
cf auth --origin uaa <username> <password>

Then, executing cf curl v3/service_brokers returns all service brokers and cf curl v3/service_brokers?names=some_name in my case returns

{"pagination":{"total_results":0,"total_pages":1,"first":{"href":"https://api.<redacted>/v3/service_brokers?names=some_name\u0026page=1\u0026per_page=50"},"last":{"href":"https://api.<redacted>/v3/service_brokers?names=some_name\u0026page=1\u0026per_page=50"},"next":null,"previous":null},"resources":[]}

and thats totally fine.

If in the cf api command the url has a trailing slash cf api <the_api_url>/ the cf curl command behaves quite unexpected. The cf api command does not return any error or warning if doing so which means, you do not see any issue to enter the api url with a trailing slash as a user.

The command cf curl v3/service_brokers still works but cf curl v3/service_brokers?names=some_name returns

{"errors":[{"detail":"Unknown request","title":"CF-NotFound","code":10000}]}

My assumption is, that internally, the api url is concatenated with the path from the curl command which leads to a double slash. This is an unexpected behaviour from my perspective and should be fixed, either by trowing an error if the url contains a trailing slash or, and I think that this would be the better solution, parse the url and remove the trailing slash when calling cf api.

I am running on cf version 8.7.3

Kind regards,
Oliver

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants