Kevin Sawicki 2016-11-11 09:22:45 -08:00
Π ΠΎΠ΄ΠΈΡ‚Π΅Π»ΡŒ 5f596b22c7
ΠšΠΎΠΌΠΌΠΈΡ‚ 50019f39e9
2 ΠΈΠ·ΠΌΠ΅Π½Ρ‘Π½Π½Ρ‹Ρ… Ρ„Π°ΠΉΠ»ΠΎΠ²: 11 Π΄ΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠΉ ΠΈ 12 ΡƒΠ΄Π°Π»Π΅Π½ΠΈΠΉ

ΠŸΡ€ΠΎΡΠΌΠΎΡ‚Ρ€Π΅Ρ‚ΡŒ Ρ„Π°ΠΉΠ»

@ -120,14 +120,13 @@ const createGuest = function (embedder, url, frameName, options, postData) {
// The above code would not work if a navigation to "about:blank" is done
// here, since the window would be cleared of all changes in the next tick.
const loadOptions = {}
if (postData) {
if (postData != null) {
loadOptions.postData = postData
loadOptions.extraHeaders = 'content-type: application/x-www-form-urlencoded'
if (postData.length) {
if (postData.length > 0) {
const postDataFront = postData[0].bytes.toString()
const regex = new RegExp(/^--.*[^-\r\n]/)
const boundary = regex.exec(postDataFront)
if (boundary) {
const boundary = /^--.*[^-\r\n]/.exec(postDataFront)
if (boundary != null) {
loadOptions.extraHeaders = `content-type: multipart/form-data; boundary=${boundary[0].substr(2)}`
}
}

ΠŸΡ€ΠΎΡΠΌΠΎΡ‚Ρ€Π΅Ρ‚ΡŒ Ρ„Π°ΠΉΠ»

@ -29,15 +29,15 @@ describe('browser-window module', function () {
const fileStats = fs.statSync(filePath)
postData = [
{
'type': 'rawData',
'bytes': new Buffer('username=test&file=')
type: 'rawData',
bytes: new Buffer('username=test&file=')
},
{
'type': 'file',
'filePath': filePath,
'offset': 0,
'length': fileStats.size,
'modificationTime': fileStats.mtime.getTime() / 1000
type: 'file',
filePath: filePath,
offset: 0,
length: fileStats.size,
modificationTime: fileStats.mtime.getTime() / 1000
}
]
server = http.createServer(function (req, res) {