Jquip.all does not build query string correctly

Configuration :

  • IIS Express
  • ServiceStack.NetFramework v.6.10
  • jQuery v.3.7.1
  • .NET Framework v.4.8

Javascript code:

             $.ajax({
                 url: "/api/isusermonitoredproduct?productId=316614 "
             }).done(function(response) {
                 var toto = response.result;
             })

The ServiceStack MiniProfiler (when activated) calls a function in ssr-jquip.all.js that is adding a timestamp on GET http://localhost:12797/api/isusermonitoredproduct?productId=316614?_=1694683861595

The problem is that instead of adding a & it adds a ?, so the request cannot be bound on server.

In ssr-jquip.all the error is inside this function

 function ajax(e, t) {
        var a, n = _xhr(), r = 0;
        "object" == typeof e ? t = e : t.url = e,
        t = $._defaults(t, {
            userAgent: "XMLHttpRequest",
            lang: "en",
            type: "GET",
            data: null,
            contentType: "application/x-www-form-urlencoded",
            dataType: null,
            processData: !0,
            headers: {
                "X-Requested-With": "XMLHttpRequest"
            },
            cache: !0
        }),
        t.timeout && (a = setTimeout(function() {
            n.abort(),
            t.timeoutFn && t.timeoutFn(t.url)
        }, t.timeout));
        var s = $(t.context || document)
          , o = s;
        n.onreadystatechange = function() {
            if (4 == n.readyState) {
                if (a && clearTimeout(a),
                n.status < 300) {
                    var e, c = !0, u = t.dataType || "";
                    try {
                        e = _xhrResp(n, u, t)
                    } catch (i) {
                        c = !1,
                        t.error && t.error(n, n.status, n.statusText),
                        o.trigger(s, "ajaxError", [n, n.statusText, t])
                    }
                    t.success && c && (u.indexOf("json") >= 0 || e) && t.success(e),
                    o.trigger(s, "ajaxSuccess", [n, e, t])
                } else
                    t.error && t.error(n, n.status, n.statusText),
                    o.trigger(s, "ajaxError", [n, n.statusText, t]);
                t.complete && t.complete(n, n.statusText),
                o.trigger(s, "ajaxComplete", [n, t])
            } else
                t.progress && t.progress(++r)
        }
        ;
        var e = t.url
          , c = null
          , u = 1 == t.cache
          , i = "POST" == t.type || "PUT" == t.type;
        t.data && t.processData && "object" == typeof t.data && (c = $.formData(t.data)),
        !i && c && (e += "?" + c,
        c = null,
        u || (e = e + "&_=" + (new Date).getTime())),
        e = e + "?_=" + (new Date).getTime(),
        u = null,
        n.open(t.type, e),
        n.setRequestHeader("Accept", t.dataType && accepts[t.dataType] || accepts["*"]);
        try {
            for (var p in t.headers)
                n.setRequestHeader(p, t.headers[p])
        } catch (x) {
            console.log(x)
        }
        i && (t.contentType.indexOf("json") >= 0 && (c = t.data),
        n.setRequestHeader("Content-Type", t.contentType)),
        n.send(c)
    }

Before I was using ServiceStack v.5.0.14 with jQuery v.3.6.0 and .NET Framework v.4.6.2

Thank you.

Do you know where MiniProfiler makes this $.ajax call?

I couldn’t find where MiniProfiler made this $.ajax call so had a go at fixing the $.ajax method which should be resolved from the latest v6.10.1 that’s now available in our Pre Release Packages.

I confirm that the bug is fixed with latest 6.11.0.
Thank you very much!

1 Like