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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Guillaume Royer
jio
Commits
a09b0ce5
Commit
a09b0ce5
authored
Jan 22, 2019
by
Guillaume Royer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(xhr2): handle FormData response type
parent
a1342e11
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 @
a09b0ce5
// Generated by CoffeeScript 1.12.
2
// Generated by CoffeeScript 1.12.
7
(
function
()
{
(
function
()
{
var
InvalidStateError
,
NetworkError
,
ProgressEvent
,
SecurityError
,
SyntaxError
,
XMLHttpRequest
,
XMLHttpRequestEventTarget
,
XMLHttpRequestUpload
,
http
,
https
,
os
,
url
,
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
;
},
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 @@
...
@@ -323,7 +323,7 @@
'
access-control-request-method
'
:
true
,
'
access-control-request-method
'
:
true
,
connection
:
true
,
connection
:
true
,
'
content-length
'
:
true
,
'
content-length
'
:
true
,
//
cookie: true,
cookie
:
true
,
cookie2
:
true
,
cookie2
:
true
,
date
:
true
,
date
:
true
,
dnt
:
true
,
dnt
:
true
,
...
@@ -341,7 +341,7 @@
...
@@ -341,7 +341,7 @@
};
};
XMLHttpRequest
.
prototype
.
_privateHeaders
=
{
XMLHttpRequest
.
prototype
.
_privateHeaders
=
{
//
'set-cookie': true,
'
set-cookie
'
:
true
,
'
set-cookie2
'
:
true
'
set-cookie2
'
:
true
};
};
...
@@ -363,6 +363,7 @@
...
@@ -363,6 +363,7 @@
};
};
XMLHttpRequest
.
prototype
.
_sendHttp
=
function
(
data
)
{
XMLHttpRequest
.
prototype
.
_sendHttp
=
function
(
data
)
{
var
that
;
if
(
this
.
_sync
)
{
if
(
this
.
_sync
)
{
throw
new
Error
(
"
Synchronous XHR processing not implemented
"
);
throw
new
Error
(
"
Synchronous XHR processing not implemented
"
);
}
}
...
@@ -372,9 +373,11 @@
...
@@ -372,9 +373,11 @@
}
else
{
}
else
{
data
||
(
data
=
''
);
data
||
(
data
=
''
);
}
}
this
.
upload
.
_setData
(
data
);
that
=
this
;
this
.
_finalizeHeaders
();
this
.
upload
.
_setData
(
data
,
function
()
{
this
.
_sendHxxpRequest
();
that
.
_finalizeHeaders
();
return
that
.
_sendHxxpRequest
();
});
return
void
0
;
return
void
0
;
};
};
...
@@ -709,11 +712,13 @@
...
@@ -709,11 +712,13 @@
XMLHttpRequest
.
XMLHttpRequest
=
XMLHttpRequest
;
XMLHttpRequest
.
XMLHttpRequest
=
XMLHttpRequest
;
XMLHttpRequest
.
FormData
=
FormData
;
SecurityError
=
(
function
(
superClass
)
{
SecurityError
=
(
function
(
superClass
)
{
extend
(
SecurityError
,
superClass
);
extend
(
SecurityError
,
superClass
);
function
SecurityError
()
{
function
SecurityError
()
{
SecurityError
.
__super__
.
constructor
.
apply
(
this
,
argument
s
);
SecurityError
.
__super__
.
constructor
.
call
(
thi
s
);
}
}
return
SecurityError
;
return
SecurityError
;
...
@@ -726,7 +731,7 @@
...
@@ -726,7 +731,7 @@
extend
(
InvalidStateError
,
superClass
);
extend
(
InvalidStateError
,
superClass
);
function
InvalidStateError
()
{
function
InvalidStateError
()
{
InvalidStateError
.
__super__
.
constructor
.
apply
(
this
,
argument
s
);
InvalidStateError
.
__super__
.
constructor
.
call
(
thi
s
);
}
}
return
InvalidStateError
;
return
InvalidStateError
;
...
@@ -750,7 +755,7 @@
...
@@ -750,7 +755,7 @@
extend
(
NetworkError
,
superClass
);
extend
(
NetworkError
,
superClass
);
function
NetworkError
()
{
function
NetworkError
()
{
NetworkError
.
__super__
.
constructor
.
apply
(
this
,
argument
s
);
NetworkError
.
__super__
.
constructor
.
call
(
thi
s
);
}
}
return
NetworkError
;
return
NetworkError
;
...
@@ -763,7 +768,7 @@
...
@@ -763,7 +768,7 @@
extend
(
SyntaxError
,
superClass
);
extend
(
SyntaxError
,
superClass
);
function
SyntaxError
()
{
function
SyntaxError
()
{
SyntaxError
.
__super__
.
constructor
.
apply
(
this
,
argument
s
);
SyntaxError
.
__super__
.
constructor
.
call
(
thi
s
);
}
}
return
SyntaxError
;
return
SyntaxError
;
...
@@ -813,10 +818,10 @@
...
@@ -813,10 +818,10 @@
return
void
0
;
return
void
0
;
};
};
XMLHttpRequestUpload
.
prototype
.
_setData
=
function
(
data
)
{
XMLHttpRequestUpload
.
prototype
.
_setData
=
function
(
data
,
cb
)
{
var
body
,
i
,
j
,
k
,
offset
,
ref
,
ref1
,
view
;
var
body
,
i
,
j
,
k
,
offset
,
ref
,
ref1
,
that
,
view
;
if
(
typeof
data
===
'
undefined
'
||
data
===
null
)
{
if
(
typeof
data
===
'
undefined
'
||
data
===
null
)
{
return
;
return
cb
()
;
}
}
if
(
typeof
data
===
'
string
'
)
{
if
(
typeof
data
===
'
string
'
)
{
if
(
data
.
length
!==
0
)
{
if
(
data
.
length
!==
0
)
{
...
@@ -840,10 +845,23 @@
...
@@ -840,10 +845,23 @@
body
[
i
]
=
view
[
i
+
offset
];
body
[
i
]
=
view
[
i
+
offset
];
}
}
this
.
_body
=
body
;
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
{
}
else
{
throw
new
Error
(
"
Unsupported send() data
"
+
data
);
throw
new
Error
(
"
Unsupported send() data
"
+
data
);
}
}
return
void
0
;
return
cb
()
;
};
};
XMLHttpRequestUpload
.
prototype
.
_finalizeHeaders
=
function
(
headers
,
loweredHeaders
)
{
XMLHttpRequestUpload
.
prototype
.
_finalizeHeaders
=
function
(
headers
,
loweredHeaders
)
{
...
@@ -872,4 +890,4 @@
...
@@ -872,4 +890,4 @@
XMLHttpRequest
.
XMLHttpRequestUpload
=
XMLHttpRequestUpload
;
XMLHttpRequest
.
XMLHttpRequestUpload
=
XMLHttpRequestUpload
;
}).
call
(
this
);
}).
call
(
this
);
\ No newline at end of file
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