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

Support string values for endpoint in JS client #12

Open
oubiwann opened this issue Aug 28, 2017 · 1 comment
Open

Support string values for endpoint in JS client #12

oubiwann opened this issue Aug 28, 2017 · 1 comment
Milestone

Comments

@oubiwann
Copy link
Member

This currently doesn't work:

var client = cmr.client.search.create_client({"endpoint": "local"});

Which means that the JS client can only run against prod right now ...

@oubiwann oubiwann modified the milestone: 0.2.0 Sep 2, 2017
@axocomm
Copy link

axocomm commented Oct 6, 2017

Have you observed this happening with the token option as well? That's also being ignored on my end.

Looks like this could be as simple as options being passed around as an Object when coming from JavaScript. The function returned by create-service-client-constructor retrieves the endpoint and token with those two get-default-* functions which both accept options. Unfortunately, at this point, options is an Object and those values both end up being defaulted/nil.

I see this is handled to some degree in the ClojureScript version of base-impl/create-options wherein js->clj is called to convert options to a map before making it into a CMRClientOptions record.

If that sounds like it could be the issue, I'm wondering if you had any thoughts on most cleanly implementing a fix. It doesn't look like options is being used anywhere on its own downstream from the function returned by create-service-client-constructor, so perhaps a similar mechanism to the transformation of http-options will do (just the js->clj part of course)? After trying something like this, endpoint and token are both successfully populated and fallback to defaults when not provided.

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