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

[HTTP] Call controller actions using URL from _publicApi instead of _query endpoint #73

Merged
merged 37 commits into from
Apr 27, 2022

Conversation

Shiranuit
Copy link
Contributor

@Shiranuit Shiranuit commented Apr 20, 2022

This PR depends on kuzzleio/kuzzle#2342
The tests will not pass until this PR (kuzzleio/kuzzle#2342) is merged and Kuzzle is released.

What does this PR do ?

This PR add the capability of calling controller's actions directly using their HTTP Endpoint instead of using the _query endpoint.
The SDK is going to try to fetch HTTP Endpoint from /_publicApi and build the routes to directly call the HTTP Endpoint.
If the SDK cannot fetch or build the routes from /_publicApi, it will fallback using the /_query endpoint

Other changes

Headers can now be added by adding a headers property in the request sent using query

HashMap<String, Object> request = new HashMap();
HashMap<String, Object> headers = new HashMap();

headers.put("foo", "bar");
headers.put("origin", baz");

request.put("headers", headers);

sdk.query(request);

Headers are returned in the Response object

@Shiranuit Shiranuit marked this pull request as ready for review April 20, 2022 15:06
@Shiranuit Shiranuit force-pushed the call-proper-http-routes branch from 05af4e1 to 7c33d83 Compare April 25, 2022 17:32
@Shiranuit Shiranuit merged commit bb77cd5 into 1-dev Apr 27, 2022
@Shiranuit Shiranuit deleted the call-proper-http-routes branch April 27, 2022 14:11
@Shiranuit Shiranuit mentioned this pull request Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants