Skip to content

Commit

Permalink
fix(lib-core): fixing for axios
Browse files Browse the repository at this point in the history
  • Loading branch information
mkucharz committed Nov 27, 2018
1 parent 29538f8 commit 7809576
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
22 changes: 10 additions & 12 deletions packages/lib-js-core/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,16 @@ export function parseJSON (response) {
const mimetype = response.headers.get('Content-Type')

if (response.status === 204 || mimetype === null) {
return Promise.resolve({
data: undefined,
...response
})
response.data = undefined
return Promise.resolve(response)
}

// Parse JSON
if (/^.*\/.*\+json/.test(mimetype) || /^application\/json/.test(mimetype)) {
return response.json().then(res => ({
data: res,
...response
}))
return response.json().then(res => {
response.data = res
return response
})
}

// Parse XML and plain text
Expand All @@ -58,10 +56,10 @@ export function parseJSON (response) {
/^.*\/.*\+xml/.test(mimetype) ||
mimetype === 'text/plain'
) {
return response.text().then(res => ({
data: res,
...response
}))
return response.text().then(res => {
response.data = res
return response
})
}

return response.arrayBuffer()
Expand Down
1 change: 0 additions & 1 deletion packages/lib-js-validate/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export default class Validator {
}

// Should we validate empty schema?
console.log('YYY validateResponse')
if (!responseSchema || !isEmpty(responseSchema)) {
return true
}
Expand Down

0 comments on commit 7809576

Please sign in to comment.