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

Mock endpoints are not encoded #116

Open
lbroudoux opened this issue Dec 17, 2024 · 3 comments
Open

Mock endpoints are not encoded #116

lbroudoux opened this issue Dec 17, 2024 · 3 comments
Labels
component/runtime Runtime behavior of test container kind/bug Something isn't working kind/question Further information is requested

Comments

@lbroudoux
Copy link
Member

Describe the bug

When retrieving the endpoint name using getRestMockEndpoint() or some others getGraphQLMockEndpoint()... methods, it appears that API name and version and not URL-encoded like the Microcks server expect them to be.

Expected behavior

API names and versions containing accents or special characters should be URL encoded.

As an example, API permettant de gérer les pâtisseries should be encoded into API%20permettant%20de%20g%C3%A9rer%20les%20p%C3%A2tisseries or API+permettant+de+g%C3%A9rer+les+p%C3%A2tisseries.

Actual behavior

As of today, there's no encoding and API permettant de gérer les pâtisseries is returned as is. The workaround being that is the user responsibility to know that it should be URL-encoded before actually used.

How to Reproduce?

See above.

Microcks version or git rev

all

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

No response

Additional information

No response

@lbroudoux lbroudoux added the kind/bug Something isn't working label Dec 17, 2024
@lbroudoux lbroudoux self-assigned this Dec 17, 2024
@lbroudoux lbroudoux added the component/runtime Runtime behavior of test container label Dec 17, 2024
@lbroudoux lbroudoux added this to the 0.2.11 milestone Dec 17, 2024
@lbroudoux
Copy link
Member Author

It appears that some libraries, like RestAssured, don't expect already encoded endpoints, so they tend to re-encode them. This leads to 404 errors because we're not matching any endpoints on the server side.

I think the option could be to provide an additional set of methods like getEncoded RestMockEndpoint() and people would choose between one or the other depending on their HTTP client library.

Thinking about it, this lib's behavior is the same regardless of the binding language (Java, Go, NodeJS, NET); they all provide non-encoded URLs, and all the clients manage to encode them on the fly.

@f-lopes What do you think? What client are you using that causes you trouble?

@f-lopes
Copy link

f-lopes commented Dec 17, 2024

A new method, getEncodedRestMockEndpoint(), could provide a good alternative.

The client I am using is not representative of my future needs, so I will stick to encoding the URL myself, if needed, or use the new potential method if planned.

Thanks for your quick response!

@lbroudoux lbroudoux changed the title Mock endpoints are not correctly encoded Mock endpoints are not encoded Dec 18, 2024
@lbroudoux lbroudoux removed this from the 0.2.11 milestone Dec 18, 2024
@lbroudoux
Copy link
Member Author

Ok, thanks. I'm putting a hold on this at the moment. I let the issue open much more as a way to collect feedback whether we have to do something or not.

@lbroudoux lbroudoux added the kind/question Further information is requested label Dec 18, 2024
@lbroudoux lbroudoux removed their assignment Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/runtime Runtime behavior of test container kind/bug Something isn't working kind/question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants