codeant-ai-for-open-source[bot] commented on code in PR #45204:
URL: https://github.com/apache/superset/pull/45204#discussion_r4246205934
##########
superset-frontend/packages/superset-ui-core/src/connection/SupersetClientClass.ts:
##########
@@ -149,15 +149,27 @@ export default class SupersetClientClass {
return this.fetchCSRFToken();
}
+ /**
+ * Submit a hidden form via POST.
+ * @param endpointOrConfig - an endpoint (resolved against the app root), or
+ * an object with either an `endpoint` or an already absolute `url`, which
+ * is used as is.
+ * @param payload - form fields
+ * @param target - form target, defaults to a new tab
+ */
async postForm(
- endpoint: string,
+ endpointOrConfig: string | { endpoint?: string; url?: string },
payload: Record<string, any>,
target = '_blank',
) {
- if (endpoint) {
+ const { endpoint, url } =
+ typeof endpointOrConfig === 'string'
+ ? { endpoint: endpointOrConfig, url: undefined }
+ : endpointOrConfig;
+ if (endpoint || url) {
await this.ensureAuth();
const hiddenForm = document.createElement('form');
- hiddenForm.action = sanitizeUrl(this.getUrl({ endpoint }));
+ hiddenForm.action = sanitizeUrl(this.getUrl({ endpoint, url }));
Review Comment:
✅ **CodeAnt verified this suggestion was addressed in subsequent commits and
marked this thread resolved** as of `4b33325`.
For an explicit `url`, the code parses the action URL and throws unless its
origin matches the page origin or the configured client origin, before adding
tokens to the form.
<sub>If that's not right, unresolve this thread and CodeAnt will leave it
open.</sub>
<!-- codeant-auto-resolve-reply -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]