vue-resource
vue-resource copied to clipboard
What is the definition of bodyText vs body
Any documentation describe the difference?
Hi!
As I understood from source code, bodyText is string representation of response body, and body is parsed text into object:
https://github.com/pagekit/vue-resource/blob/61b1efc119ba89a9507ef5c72f1661fcd4db7440/src/http/interceptor/json.js
if (type.indexOf('application/json') === 0 || isJson(text)) {
try {
response.body = JSON.parse(text);
} catch (e) {
response.body = null;
}
}
else {
response.body = text;
}
In my case in body I get XML content, so it can't be parsed as JSON the body is null, but bodyText is string with XML content.