Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
11155c42
Commit
11155c42
authored
Jul 04, 2016
by
Ray Schamp
Committed by
GitHub
Jul 04, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #661 from rschamp/bugfix/654
Fix JSON response parsing in IE
parents
bfd8bcd6
b89d6445
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
src/lib/api.js
src/lib/api.js
+10
-0
No files found.
src/lib/api.js
View file @
11155c42
...
...
@@ -54,6 +54,16 @@ module.exports = function (opts, callback) {
}
xhr
(
opts
,
function
(
err
,
res
,
body
)
{
if
(
err
)
log
.
error
(
err
);
if
(
opts
.
responseType
===
'
json
'
&&
typeof
body
===
'
string
'
)
{
// IE doesn't parse responses as JSON without the json attribute,
// even with responseType: 'json'.
// See https://github.com/Raynos/xhr/issues/123
try
{
body
=
JSON
.
parse
(
body
);
}
catch
(
e
)
{
// Not parseable anyway, don't worry about it
}
}
// Legacy API responses come as lists, and indicate to redirect the client like
// [{success: true, redirect: "/location/to/redirect"}]
try
{
...
...
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