-
Notifications
You must be signed in to change notification settings - Fork 34
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
apiUrl
should be able to apply path
#10699
#10700
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #10700 +/- ##
============================================
- Coverage 84.55% 84.55% -0.01%
- Complexity 19958 19971 +13
============================================
Files 2633 2633
Lines 69255 69290 +35
Branches 5588 5591 +3
============================================
+ Hits 58561 58588 +27
- Misses 8000 8002 +2
- Partials 2694 2700 +6 ☔ View full report in Codecov by Sentry. |
const bean = __.newBean<ApiUrlHandler>('com.enonic.xp.lib.portal.url.ApiUrlHandler'); | ||
return bean.createUrl(__.toScriptValue(params)); | ||
bean.setPath(([] as string[]).concat(path)); |
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.
Single string must not be interpreted as single element array.
We should reserve string to preencoded path.
@@ -8,14 +8,22 @@ const url = portalLib.apiUrl({ | |||
params: { | |||
a: 1, | |||
b: 2 | |||
} | |||
}, | |||
path: 'mypath' |
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.
mypath/subpath
would be a better example
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.
I don't agree with that. You left the comment #10698 (comment) where your idea is better, than you wrote here.
@@ -8,14 +8,22 @@ const url = portalLib.apiUrl({ | |||
params: { | |||
a: 1, | |||
b: 2 | |||
} | |||
}, | |||
path: 'mypath' |
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.
path: 'mypath' | |
path: 'mypath/subpath' |
bean.setPath(([] as string[]).concat(path)); | ||
if (path) { | ||
if (Array.isArray(path)) { | ||
bean.setPath(__.toScriptValue(([] as string[]).concat(path))); |
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.
bean.setPath(__.toScriptValue(([] as string[]).concat(path))); | |
bean.setPath(__.toScriptValue(path)); |
{ | ||
this.path = value; | ||
if ( value instanceof ScriptValue && ( (ScriptValue) value ).isArray() ) |
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 is work of ApiUrlHander.
Also one pathSegments should accept List, another path - accepts path
No description provided.