Chrome dev tools truncates the form data while showing in request headers if it contains “=”

StackOverflow https://stackoverflow.com/questions/7837462

سؤال

I am not able to see the complete query parameter in chrome dev tools in query string contains "=". It shows only till "=" and truncates there after.

Firebug shows it properly. Please find the screenshots from firebug and chrome devtools for the ajax snippet shown here.

    var qstring = "Hello=Hai";

    $.ajax({
        type: 'POST'
        , url: "/cgi-bin/printenv.pl"
        , data: "query=" + qstring
        , dataType: 'xml'
        , timeout: 10000
        , success: function(jQuerySuccessData){
                    }
            });

Firebug shows the complete query parameter

Chrome dev tools doesn't show the complete query parameter

Is there any workaround available for this?

Thanks, Naga Kiran

هل كانت مفيدة؟

المحلول

You need to urlencode the query string as = is a reserved character. The easiest way to do this would be the escape function in javascript. Make sure you urldecode on the other side as well.

نصائح أخرى

jQuery Ajax uses contentType :"application/x-www-form-urlencoded" by default.

                $.ajax({
                    type: 'POST'
                    , url: (isCLI == false ? this.execUiQuery : this.execCli)
                    , data: qstring
                    , dataType: 'xml'
                    , contentType: 'text/plain'
                    , timeout: 10000
                  });

I have overriden this setting and set as "text/plain" using javascript edit in chrome devtools and its showing the complete query string.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top