Stefan Hermanek
Stefan Hermanek

Reputation: 103

m.request: use URL which contains colons

I have a m.request call like this:

    mCmdName = "cn:cmd:list:deselectAll";
    m.request({
        method : "POST",
        url : "/testing/cmd/" + mCmdName,
        data: data
    });

Now m.request calls

 xhrOptions.url = parameterizeUrl(xhrOptions.url, xhrOptions.data);

and tries to replace all ':[name]' parts with data[name] which results in 'undefined' as data doesn't contain any of the keys. Data is just the data object of the XHR request.

Is there a way to prohibit this default behavior?

Thanks, Stefan

PS: I'm asking here and not in mithril mailing list because I can't post there for incomprehensible reasons. Maybe somebody can give me a hint on this.

Upvotes: 0

Views: 98

Answers (1)

pelón
pelón

Reputation: 413

Have you tried encodeURIComponent("cn:cmd:list:deselectAll")

which gives you cn%3Acmd%3Alist%3AdeselectAll

If necessary you can decode on the server.

Upvotes: 1

Related Questions