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

Phase 2: Add other HTTP helpers #890

Open
aleksa-krolls opened this issue Jan 9, 2025 · 3 comments
Open

Phase 2: Add other HTTP helpers #890

aleksa-krolls opened this issue Jan 9, 2025 · 3 comments
Assignees

Comments

@aleksa-krolls
Copy link
Member

aleksa-krolls commented Jan 9, 2025

In Phase 1, we added a generic HTTP wrapper to OpenMRS called http.request, which allows arbitrary HTTP requests against the instanceUrl root.

As a logical extension of that, we want to add a few simple wrappers, with tests and documentation, for http.get(), http.post() and http.delete.

The new operations should include basic unit tests, along the lines of thee existing functionality.

See the http adaptor for a reference about what the APIs look like.

See parent issue #887 for details.

@martalovescoffee
Copy link

@hunterachieng could you please add an estimate to this issue?

@josephjclark
Copy link
Collaborator

Question: should we allow users to pass absolute URLs into these helpers? Can we do http.request('https://some-server.com')? If we do, it's important that we do not append OpenMRS credentials from state to the request.

The benefit of doing this is that we enable true generic HTTP through this adaptor. Users have to handle their own auth, if auth is needed.

This is actually generally discouraged - we tend to recommend creating a http step for this sort of thing.

Another reason not to do it is that it muddies the semantics of the http namespace. http.get() means "make an authorized request against the root instanceURL". If we allow absolute APIs then those semantics lose all meaning really.

@aleksa-krolls
Copy link
Member Author

aleksa-krolls commented Jan 17, 2025

@josephjclark I think it's fine to assume that we're using the same credential for these and the root instanceUrl will be the same.

Agreed that if they want to make an http request to another API (not openmrs), then they should have another http step. The whole goal of this change is to enable users to send http requests to openmrs apis, not necessarily any api.

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

No branches or pull requests

4 participants