Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/curl-command.html

Issue 2182213006: [Devtools] Fix multi-line curl copy response when multi-part-form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed windows curl with multi-line Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../http/tests/inspector/inspector-test.js"></script> 3 <script src="../http/tests/inspector/inspector-test.js"></script>
4 <script src="../http/tests/inspector/network-test.js"></script> 4 <script src="../http/tests/inspector/network-test.js"></script>
5 <script type="text/javascript"> 5 <script type="text/javascript">
6 6
7 var test = function() 7 var test = function()
8 { 8 {
9 var logView = WebInspector.panels.network._networkLogView; 9 var logView = WebInspector.panels.network._networkLogView;
10 10
11 function newRequest(headers, data, opt_url) 11 function newRequest(headers, data, opt_url)
12 { 12 {
13 var request = new WebInspector.NetworkRequest(WebInspector.targetManager .mainTarget(), 0, opt_url || 'http://example.org/path', 0, 0, 0); 13 var request = new WebInspector.NetworkRequest(WebInspector.targetManager .mainTarget(), 0, opt_url || 'http://example.org/path', 0, 0, 0);
14 request.requestMethod = data ? "POST" : "GET"; 14 request.requestMethod = data ? "POST" : "GET";
15 var headerList = []; 15 var headerList = [];
16 if (headers) { 16 if (headers) {
17 for (var i in headers) 17 for (var i in headers)
18 headerList.push({name: i, value: headers[i]}); 18 headerList.push({name: i, value: headers[i]});
19 } 19 }
20 if (data) { 20 if (data) {
21 headerList.push({name: "Content-Length", value: data.length}); 21 headerList.push({name: "Content-Length", value: data.length});
22 request.requestFormData = data; 22 request.requestFormData = data;
23 } 23 }
24 request.setRequestHeaders(headerList); 24 request.setRequestHeaders(headerList);
25 return request; 25 return request;
26 } 26 }
27 27
28 function dumpRequest(headers, data, opt_url) 28 function dumpRequest(headers, data, opt_url)
29 { 29 {
30 InspectorTest.addResult(logView._generateCurlCommand(newRequest(headers, data, opt_url), WebInspector.isWin() ? "win" : "unix")); 30 InspectorTest.addResult("Windows: " + logView._generateCurlCommand(newRe quest(headers, data, opt_url), "win"));
31 InspectorTest.addResult("Unix: " + logView._generateCurlCommand(newReque st(headers, data, opt_url), "unix"));
31 } 32 }
32 33
33 dumpRequest({}) 34 dumpRequest({})
34 dumpRequest({}, "123"); 35 dumpRequest({}, "123");
35 dumpRequest({"Content-Type": "application/x-www-form-urlencoded"}, "1&b"); 36 dumpRequest({"Content-Type": "application/x-www-form-urlencoded"}, "1&b");
36 dumpRequest({"Content-Type": "application/json"}, "{\"a\":1}"); 37 dumpRequest({"Content-Type": "application/json"}, "{\"a\":1}");
37 dumpRequest({"Content-Type": "application/binary"}, "1234\r\n\x30\x30\2\3\4\ 5\'\"!"); // expected content length: 15 38 dumpRequest({"Content-Type": "application/binary"}, "1234\r\n\x30\x30\2\3\4\ 5\'\"!");
38 dumpRequest({"Content-Type": "application/binary"}, "1234\r\n\1\x30\x30\2\3\ 4\5\'\"!"); // expected content length: 16 39 dumpRequest({"Content-Type": "application/binary"}, "1234\r\n\1\x30\x30\2\3\ 4\5\'\"!");
40 dumpRequest({"Content-Type": "application/binary"}, "%OS%\r\n%%OS%%\r\n\"\\\ "'$&!"); // Ensure %OS% for windows is not env evaled
41 dumpRequest({"Content-Type": "application/binary"}, "!@#$%^&*()_+~`123456789 0-=[]{};':\",./\r<>?\r\nqwer\nt\n\nyuiopasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVB NM");
39 dumpRequest({"Content-Type": "application/binary"}, "\x7F\x80\x90\xFF\u0009\ u0700"); 42 dumpRequest({"Content-Type": "application/binary"}, "\x7F\x80\x90\xFF\u0009\ u0700");
40 dumpRequest({}, "", "http://labs.ft.com/?querystring=[]{}"); // Character r ange symbols must be escaped (http://crbug.com/265449). 43 dumpRequest({}, "", "http://labs.ft.com/?querystring=[]{}"); // Character r ange symbols must be escaped (http://crbug.com/265449).
41 dumpRequest({"Content-Type": "application/binary"}, "%PATH%$PATH"); 44 dumpRequest({"Content-Type": "application/binary"}, "%PATH%$PATH");
42 dumpRequest({":host": "h", "version": "v"}); 45 dumpRequest({":host": "h", "version": "v"});
43 46
44 InspectorTest.completeTest(); 47 InspectorTest.completeTest();
45 } 48 }
46 49
47 </script> 50 </script>
48 </head> 51 </head>
49 <body onload="runTest()"> 52 <body onload="runTest()">
50 <p>Tests curl command generation</p> 53 <p>Tests curl command generation</p>
51 </body> 54 </body>
52 </html> 55 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698