TypeError: Body has already been consumed.
- Dominant language
- JavaScript
- Stars
- 152
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
How it happens:
vue-router displays Changelog.vue
loading main page "home" then trying to load "changelog" page.
error doesnt happen when loading changelog page first.
Error:
`TypeError: Body has already been consumed. vendors~Changelog.js line 175 > eval:427:20`
`return res.text();`
Error location:
```
methods:{
fetchFile: function fetchFile() {
var _this = this;
var changelog = this.changelog || '/CHANGELOG.md';
__WEBPACK_IMPORTED_MODULE_0_unfetch___default()(changelog).then(function (res) {
return res.text();
}).then(function (res) {
var _fm = Object(__WEBPACK_IMPORTED_MODULE_1__utils_front_matter__["a" /* default */])(res),
body = _fm.body,
attributes = _fm.attributes;
_this.site = attributes;
_this.html = Object(__WEBPACK_IMPORTED_MODULE_2__utils_markdown__["a" /* default */])(body, {
site: _this.site,
colors: Object.assign({
Fix: '#b26cee',
New: '#3778ff',
Breaking: '#ff9800'
}, _this.colors || {})
});
});
},
getDomain: function getDomain(url) {
return url.replace(/^https?:\/\//, '');
}
}
});
```
Changelog.vue
```
import { LogLive } from "loglive";
export default {
name: "changelog",
components: {
LogLive
},
data() {
return {
changelog: "/CHANGELOG.md"
};
},
mounted() {}
};
@import url("../css/loglive.css");
#changelog-container {
min-height: 100vh;
max-width: 50%;
margin: auto;
padding: 0 10px;
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with Changelog.vue and reproduce the reported navigation from the home page to the changelog page, then trace the LogLive fetchFile path shown in the error. Done means opening Changelog.vue after the home page renders the changelog without the “Body has already been consumed” TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100