Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
18
Merge Requests
18
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
jio
Commits
9a8f97f6
Commit
9a8f97f6
authored
Jan 22, 2019
by
Guillaume Royer
Committed by
Romain Courteaud
Feb 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(xhr2): handle FormData response type
parent
cc545f75
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
15 deletions
+33
-15
external/xhr2.js
external/xhr2.js
+33
-15
No files found.
external/xhr2.js
View file @
9a8f97f6
// Generated by CoffeeScript 1.12.
2
// Generated by CoffeeScript 1.12.
7
(
function
()
{
var
InvalidStateError
,
NetworkError
,
ProgressEvent
,
SecurityError
,
SyntaxError
,
XMLHttpRequest
,
XMLHttpRequestEventTarget
,
XMLHttpRequestUpload
,
http
,
https
,
os
,
url
,
extend
=
function
(
child
,
parent
)
{
for
(
var
key
in
parent
)
{
if
(
hasProp
.
call
(
parent
,
key
))
child
[
key
]
=
parent
[
key
];
}
function
ctor
()
{
this
.
constructor
=
child
;
}
ctor
.
prototype
=
parent
.
prototype
;
child
.
prototype
=
new
ctor
();
child
.
__super__
=
parent
.
prototype
;
return
child
;
},
...
...
@@ -323,7 +323,7 @@
'
access-control-request-method
'
:
true
,
connection
:
true
,
'
content-length
'
:
true
,
//
cookie: true,
cookie
:
true
,
cookie2
:
true
,
date
:
true
,
dnt
:
true
,
...
...
@@ -341,7 +341,7 @@
};
XMLHttpRequest
.
prototype
.
_privateHeaders
=
{
//
'set-cookie': true,
'
set-cookie
'
:
true
,
'
set-cookie2
'
:
true
};
...
...
@@ -363,6 +363,7 @@
};
XMLHttpRequest
.
prototype
.
_sendHttp
=
function
(
data
)
{
var
that
;
if
(
this
.
_sync
)
{
throw
new
Error
(
"
Synchronous XHR processing not implemented
"
);
}
...
...
@@ -372,9 +373,11 @@
}
else
{
data
||
(
data
=
''
);
}
this
.
upload
.
_setData
(
data
);
this
.
_finalizeHeaders
();
this
.
_sendHxxpRequest
();
that
=
this
;
this
.
upload
.
_setData
(
data
,
function
()
{
that
.
_finalizeHeaders
();
return
that
.
_sendHxxpRequest
();
});
return
void
0
;
};
...
...
@@ -709,11 +712,13 @@
XMLHttpRequest
.
XMLHttpRequest
=
XMLHttpRequest
;
XMLHttpRequest
.
FormData
=
FormData
;
SecurityError
=
(
function
(
superClass
)
{
extend
(
SecurityError
,
superClass
);
function
SecurityError
()
{
SecurityError
.
__super__
.
constructor
.
apply
(
this
,
argument
s
);
SecurityError
.
__super__
.
constructor
.
call
(
thi
s
);
}
return
SecurityError
;
...
...
@@ -726,7 +731,7 @@
extend
(
InvalidStateError
,
superClass
);
function
InvalidStateError
()
{
InvalidStateError
.
__super__
.
constructor
.
apply
(
this
,
argument
s
);
InvalidStateError
.
__super__
.
constructor
.
call
(
thi
s
);
}
return
InvalidStateError
;
...
...
@@ -750,7 +755,7 @@
extend
(
NetworkError
,
superClass
);
function
NetworkError
()
{
NetworkError
.
__super__
.
constructor
.
apply
(
this
,
argument
s
);
NetworkError
.
__super__
.
constructor
.
call
(
thi
s
);
}
return
NetworkError
;
...
...
@@ -763,7 +768,7 @@
extend
(
SyntaxError
,
superClass
);
function
SyntaxError
()
{
SyntaxError
.
__super__
.
constructor
.
apply
(
this
,
argument
s
);
SyntaxError
.
__super__
.
constructor
.
call
(
thi
s
);
}
return
SyntaxError
;
...
...
@@ -813,10 +818,10 @@
return
void
0
;
};
XMLHttpRequestUpload
.
prototype
.
_setData
=
function
(
data
)
{
var
body
,
i
,
j
,
k
,
offset
,
ref
,
ref1
,
view
;
XMLHttpRequestUpload
.
prototype
.
_setData
=
function
(
data
,
cb
)
{
var
body
,
i
,
j
,
k
,
offset
,
ref
,
ref1
,
that
,
view
;
if
(
typeof
data
===
'
undefined
'
||
data
===
null
)
{
return
;
return
cb
()
;
}
if
(
typeof
data
===
'
string
'
)
{
if
(
data
.
length
!==
0
)
{
...
...
@@ -840,10 +845,23 @@
body
[
i
]
=
view
[
i
+
offset
];
}
this
.
_body
=
body
;
}
else
if
(
data
instanceof
FormData
)
{
body
=
''
;
this
.
_contentType
=
data
.
getHeaders
()[
'
content-type
'
];
data
.
on
(
'
data
'
,
function
(
data
)
{
return
body
+=
data
.
toString
();
});
that
=
this
;
data
.
on
(
'
end
'
,
function
()
{
that
.
_body
=
body
;
return
cb
();
});
data
.
resume
();
return
;
}
else
{
throw
new
Error
(
"
Unsupported send() data
"
+
data
);
}
return
void
0
;
return
cb
()
;
};
XMLHttpRequestUpload
.
prototype
.
_finalizeHeaders
=
function
(
headers
,
loweredHeaders
)
{
...
...
@@ -872,4 +890,4 @@
XMLHttpRequest
.
XMLHttpRequestUpload
=
XMLHttpRequestUpload
;
}).
call
(
this
);
\ No newline at end of file
}).
call
(
this
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment