Commit ba4cdcec authored by PhistucK's avatar PhistucK Committed by Commit Bot

Developer Tools/Network - fixed copy as fetch not emitting headers.

This commit was made possible by Janitor -
https://janitor.technology

Bug: none
Change-Id: I4cda6d93040e52104efa93cb14f8459ae352bafe
Reviewed-on: https://chromium-review.googlesource.com/1162228Reviewed-by: default avatarAndrey Lushnikov <lushnikov@chromium.org>
Commit-Queue: PhistucK <phistuck@gmail.com>
Cr-Commit-Position: refs/heads/master@{#580747}
parent 0a1ae6ee
...@@ -3,31 +3,31 @@ Tests curl command generation ...@@ -3,31 +3,31 @@ Tests curl command generation
cURL Windows: curl "http://example.org/path" --compressed cURL Windows: curl "http://example.org/path" --compressed
cURL Unix: curl 'http://example.org/path' --compressed cURL Unix: curl 'http://example.org/path' --compressed
Powershell: Invoke-WebRequest -Uri "http://example.org/path" Powershell: Invoke-WebRequest -Uri "http://example.org/path"
fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{},"method":"GET","mode":"cors"}); fetch: fetch("http://example.org/path", {"credentials":"omit","method":"GET","mode":"cors"});
cURL Windows: curl "http://example.org/path" --data-binary "123" --compressed cURL Windows: curl "http://example.org/path" --data-binary "123" --compressed
cURL Unix: curl 'http://example.org/path' --data-binary '123' --compressed cURL Unix: curl 'http://example.org/path' --data-binary '123' --compressed
Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -Body "123" Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -Body "123"
fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{},"body":"123","method":"POST","mode":"cors"}); fetch: fetch("http://example.org/path", {"credentials":"omit","body":"123","method":"POST","mode":"cors"});
cURL Windows: curl "http://example.org/path" -H "Content-Type: application/x-www-form-urlencoded" --data "1^&b" --compressed cURL Windows: curl "http://example.org/path" -H "Content-Type: application/x-www-form-urlencoded" --data "1^&b" --compressed
cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/x-www-form-urlencoded' --data '1&b' --compressed cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/x-www-form-urlencoded' --data '1&b' --compressed
Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/x-www-form-urlencoded" -Body "1&b" Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/x-www-form-urlencoded" -Body "1&b"
fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{},"body":"1&b","method":"POST","mode":"cors"}); fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{"content-type":"application/x-www-form-urlencoded"},"body":"1&b","method":"POST","mode":"cors"});
cURL Windows: curl "http://example.org/path" -H "Content-Type: application/json" --data-binary "^{^\^"a^\^":1^}" --compressed cURL Windows: curl "http://example.org/path" -H "Content-Type: application/json" --data-binary "^{^\^"a^\^":1^}" --compressed
cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/json' --data-binary '{"a":1}' --compressed cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/json' --data-binary '{"a":1}' --compressed
Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/json" -Body "{`"a`":1}" Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/json" -Body "{`"a`":1}"
fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{},"body":"{\"a\":1}","method":"POST","mode":"cors"}); fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{"content-type":"application/json"},"body":"{\"a\":1}","method":"POST","mode":"cors"});
cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binary" --data-binary ^"1234^ cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binary" --data-binary ^"1234^
00^^^^'^\^"^!^" --compressed 00^^^^'^\^"^!^" --compressed
cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary $'1234\r\n00\x02\x03\x04\x05\'"!' --compressed cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary $'1234\r\n00\x02\x03\x04\x05\'"!' --compressed
Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/binary" -Body ([System.Text.Encoding]::UTF8.GetBytes("1234$([char]13)$([char]10)00$([char]2)$([char]3)$([char]4)$([char]5)'`"!")) Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/binary" -Body ([System.Text.Encoding]::UTF8.GetBytes("1234$([char]13)$([char]10)00$([char]2)$([char]3)$([char]4)$([char]5)'`"!"))
fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{},"body":"1234\r\n00\u0002\u0003\u0004\u0005'\"!","method":"POST","mode":"cors"}); fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{"content-type":"application/binary"},"body":"1234\r\n00\u0002\u0003\u0004\u0005'\"!","method":"POST","mode":"cors"});
cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binary" --data-binary ^"1234^ cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binary" --data-binary ^"1234^
^00^^^^'^\^"^!^" --compressed ^00^^^^'^\^"^!^" --compressed
cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary $'1234\r\n\x0100\x02\x03\x04\x05\'"!' --compressed cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary $'1234\r\n\x0100\x02\x03\x04\x05\'"!' --compressed
Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/binary" -Body ([System.Text.Encoding]::UTF8.GetBytes("1234$([char]13)$([char]10)$([char]1)00$([char]2)$([char]3)$([char]4)$([char]5)'`"!")) Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/binary" -Body ([System.Text.Encoding]::UTF8.GetBytes("1234$([char]13)$([char]10)$([char]1)00$([char]2)$([char]3)$([char]4)$([char]5)'`"!"))
fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{},"body":"1234\r\n\u000100\u0002\u0003\u0004\u0005'\"!","method":"POST","mode":"cors"}); fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{"content-type":"application/binary"},"body":"1234\r\n\u000100\u0002\u0003\u0004\u0005'\"!","method":"POST","mode":"cors"});
cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binary" --data-binary ^"^%^OS^%^ cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binary" --data-binary ^"^%^OS^%^
^%^%^OS^%^%^ ^%^%^OS^%^%^
...@@ -35,7 +35,7 @@ cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binar ...@@ -35,7 +35,7 @@ cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binar
^\^"^\^\^\^"'^$^&^!^" --compressed ^\^"^\^\^\^"'^$^&^!^" --compressed
cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary $'%OS%\r\n%%OS%%\r\n"\\"\'$&!' --compressed cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary $'%OS%\r\n%%OS%%\r\n"\\"\'$&!' --compressed
Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/binary" -Body ([System.Text.Encoding]::UTF8.GetBytes("%OS%$([char]13)$([char]10)%%OS%%$([char]13)$([char]10)`"\`"'`$&!")) Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/binary" -Body ([System.Text.Encoding]::UTF8.GetBytes("%OS%$([char]13)$([char]10)%%OS%%$([char]13)$([char]10)`"\`"'`$&!"))
fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{},"body":"%OS%\r\n%%OS%%\r\n\"\\\"'$&!","method":"POST","mode":"cors"}); fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{"content-type":"application/binary"},"body":"%OS%\r\n%%OS%%\r\n\"\\\"'$&!","method":"POST","mode":"cors"});
cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binary" --data-binary ^"^!^@^#^$^%^^^&*()_+~`1234567890-=^[^]^{^};':^\^",./^ cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binary" --data-binary ^"^!^@^#^$^%^^^&*()_+~`1234567890-=^[^]^{^};':^\^",./^
^<^>?^ ^<^>?^
...@@ -49,25 +49,25 @@ t^ ...@@ -49,25 +49,25 @@ t^
yuiopasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVBNM^" --compressed yuiopasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVBNM^" --compressed
cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary $'!@#$%^&*()_+~`1234567890-=[]{};\':",./\r<>?\r\nqwer\nt\n\nyuiopasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVBNM' --compressed cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary $'!@#$%^&*()_+~`1234567890-=[]{};\':",./\r<>?\r\nqwer\nt\n\nyuiopasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVBNM' --compressed
Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/binary" -Body ([System.Text.Encoding]::UTF8.GetBytes("!@#`$%^&*()_+~``1234567890-=[]{};':`",./$([char]13)<>?$([char]13)$([char]10)qwer$([char]10)t$([char]10)$([char]10)yuiopasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVBNM")) Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/binary" -Body ([System.Text.Encoding]::UTF8.GetBytes("!@#`$%^&*()_+~``1234567890-=[]{};':`",./$([char]13)<>?$([char]13)$([char]10)qwer$([char]10)t$([char]10)$([char]10)yuiopasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVBNM"))
fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{},"body":"!@#$%^&*()_+~`1234567890-=[]{};':\",./\r<>?\r\nqwer\nt\n\nyuiopasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVBNM","method":"POST","mode":"cors"}); fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{"content-type":"application/binary"},"body":"!@#$%^&*()_+~`1234567890-=[]{};':\",./\r<>?\r\nqwer\nt\n\nyuiopasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVBNM","method":"POST","mode":"cors"});
cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binary" --data-binary "^^€^^ÿ ^܀" --compressed cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binary" --data-binary "^^€^^ÿ ^܀" --compressed
cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary $'\x7f\x80\x90\xff\x09\u0700' --compressed cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary $'\x7f\x80\x90\xff\x09\u0700' --compressed
Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/binary" -Body ([System.Text.Encoding]::UTF8.GetBytes("$([char]127)$([char]128)$([char]144)$([char]255)$([char]9)$([char]1792)")) Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/binary" -Body ([System.Text.Encoding]::UTF8.GetBytes("$([char]127)$([char]128)$([char]144)$([char]255)$([char]9)$([char]1792)"))
fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{},"body":"€ÿ\t܀","method":"POST","mode":"cors"}); fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{"content-type":"application/binary"},"body":"€ÿ\t܀","method":"POST","mode":"cors"});
cURL Windows: curl "http://labs.ft.com/?querystring=^\[^\]^\{^\}" --compressed cURL Windows: curl "http://labs.ft.com/?querystring=^\[^\]^\{^\}" --compressed
cURL Unix: curl 'http://labs.ft.com/?querystring=\[\]\{\}' --compressed cURL Unix: curl 'http://labs.ft.com/?querystring=\[\]\{\}' --compressed
Powershell: Invoke-WebRequest -Uri "http://labs.ft.com/?querystring=[]{}" Powershell: Invoke-WebRequest -Uri "http://labs.ft.com/?querystring=[]{}"
fetch: fetch("http://labs.ft.com/?querystring=[]{}", {"credentials":"omit","headers":{},"body":null,"method":"GET","mode":"cors"}); fetch: fetch("http://labs.ft.com/?querystring=[]{}", {"credentials":"omit","body":null,"method":"GET","mode":"cors"});
cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binary" --data-binary "^%^PATH^%^$PATH" --compressed cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binary" --data-binary "^%^PATH^%^$PATH" --compressed
cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary '%PATH%$PATH' --compressed cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary '%PATH%$PATH' --compressed
Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/binary" -Body "%PATH%`$PATH" Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/binary" -Body "%PATH%`$PATH"
fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{},"body":"%PATH%$PATH","method":"POST","mode":"cors"}); fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{"content-type":"application/binary"},"body":"%PATH%$PATH","method":"POST","mode":"cors"});
cURL Windows: curl "http://example.org/path" --compressed cURL Windows: curl "http://example.org/path" --compressed
cURL Unix: curl 'http://example.org/path' --compressed cURL Unix: curl 'http://example.org/path' --compressed
Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Headers @{"version"="v"} Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Headers @{"version"="v"}
fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{},"method":"GET","mode":"cors"}); fetch: fetch("http://example.org/path", {"credentials":"omit","method":"GET","mode":"cors"});
cURL Windows: curl "http://example.org/path" -H "Cookie: _x=fdsfs; aA=fdsfdsf; FOO=ID=BAR:BAZ=FOO:F=d:AO=21.212.2.212-:A=dsadas8d9as8d9a8sd9sa8d9a; AAA=117" --compressed cURL Windows: curl "http://example.org/path" -H "Cookie: _x=fdsfs; aA=fdsfdsf; FOO=ID=BAR:BAZ=FOO:F=d:AO=21.212.2.212-:A=dsadas8d9as8d9a8sd9sa8d9a; AAA=117" --compressed
cURL Unix: curl 'http://example.org/path' -H 'Cookie: _x=fdsfs; aA=fdsfdsf; FOO=ID=BAR:BAZ=FOO:F=d:AO=21.212.2.212-:A=dsadas8d9as8d9a8sd9sa8d9a; AAA=117' --compressed cURL Unix: curl 'http://example.org/path' -H 'Cookie: _x=fdsfs; aA=fdsfdsf; FOO=ID=BAR:BAZ=FOO:F=d:AO=21.212.2.212-:A=dsadas8d9as8d9a8sd9sa8d9a; AAA=117' --compressed
Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Headers @{"Cookie"="_x=fdsfs; aA=fdsfdsf; FOO=ID=BAR:BAZ=FOO:F=d:AO=21.212.2.212-:A=dsadas8d9as8d9a8sd9sa8d9a; AAA=117"} Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Headers @{"Cookie"="_x=fdsfs; aA=fdsfdsf; FOO=ID=BAR:BAZ=FOO:F=d:AO=21.212.2.212-:A=dsadas8d9as8d9a8sd9sa8d9a; AAA=117"}
fetch: fetch("http://example.org/path", {"credentials":"include","headers":{},"method":"GET","mode":"cors"}); fetch: fetch("http://example.org/path", {"credentials":"include","method":"GET","mode":"cors"});
...@@ -1544,8 +1544,7 @@ Network.NetworkLogView = class extends UI.VBox { ...@@ -1544,8 +1544,7 @@ Network.NetworkLogView = class extends UI.VBox {
const headers = {}; const headers = {};
for (const headerArray of headerData) for (const headerArray of headerData)
headers[headerArray[0]] = headers[headerArray[1]]; headers[headerArray[0]] = headerArray[1];
const credentials = const credentials =
request.requestCookies || requestHeaders.some(({name}) => credentialHeaders[name.toLowerCase()]) ? 'include' : request.requestCookies || requestHeaders.some(({name}) => credentialHeaders[name.toLowerCase()]) ? 'include' :
...@@ -1561,7 +1560,7 @@ Network.NetworkLogView = class extends UI.VBox { ...@@ -1561,7 +1560,7 @@ Network.NetworkLogView = class extends UI.VBox {
const fetchOptions = { const fetchOptions = {
credentials, credentials,
headers, headers: Object.keys(headers).length ? headers : void 0,
referrer, referrer,
referrerPolicy, referrerPolicy,
body: requestBody, body: requestBody,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment