Chrome dev tools truncates the form data while showing in request headers if it contains “=”
-
27-10-2019 - |
문제
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){ } });
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.