-
Notifications
You must be signed in to change notification settings - Fork 55
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
Optional urlPrefix and apiVersion for Platform.createUrl. #95
Optional urlPrefix and apiVersion for Platform.createUrl. #95
Conversation
1 similar comment
The better idea would be to just add something like |
Not sure, that it would a better idea. Thus, we would initialize the SDK object with some |
The idea is that if I don't think there will be too many prefixes and that they will appear very frequently. We should not force customers to figure out what function to call to format URL correctly: in my opinion, |
I decided to neglect the merging predefined knownPrefixes with passed knownPrefixes, in order to keep code base small (avoiding extra dependencies). Let me know if it's (necessity of merge) really a case. |
src/platform/Platform.js
Outdated
|
||
if (options.addServer && !hasHttp) builtUrl += this._server; | ||
|
||
if (path.indexOf(Platform._urlPrefix) == -1 && !hasHttp) builtUrl += Platform._urlPrefix + '/' + Platform._apiVersion; | ||
if (path.indexOf(Platform._urlPrefix) == -1 && !hasHttp && !alreadyPrefixed) { | ||
builtUrl += [Platform._urlPrefix, Platform._apiVersion].join('/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird code style to add a slash between two strings )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just more efficient than string concatenation. Anyway, i can replace it.
@@ -78,6 +78,10 @@ function Platform(options) { | |||
/** @private */ | |||
this._client = options.client; | |||
|
|||
/** @private */ | |||
this._knownPrefixes = options.knownPrefixes || Platform._knownPrefixes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's OK.
All good. Please bump minor version, make a build and update this PR. Also please figure out what's wrong with failed CI on Node 4, maybe we should kick it out of stack. |
I have no idea why it fails just on Node 4, being run in Travis. Error seems to be irrelevant to node version, furthermore it run normally on my machine, using the very same version of node.
which generates suspicious URLs:
Hope, that may give you a hint to fix that issue. |
Remove Node 4 from |
Are you sure to remove it? Version of node is hardly a reason, assuming results of recent build . |
This is how we're about to utilize it: