Skip to content

Commit

Permalink
fix: url has params , not match
Browse files Browse the repository at this point in the history
  • Loading branch information
hubcarl committed Feb 7, 2018
1 parent da243fe commit c084e72
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ module.exports = app => {

if (app.config.webpack.proxy) {
app.use(function* (next) {
const ext = path.extname(this.url).toLocaleLowerCase().replace(/^\./, '');
const url = this.url.split('?')[0];
const ext = path.extname(url).toLocaleLowerCase().replace(/^\./, '');
const proxyMapping = app.config.webpack.proxyMapping;
const matched = Object.keys(proxyMapping).some(item => {
return item === ext;
});
if (matched) {
const filepath = Utils.normalizeProxyUrlFile(app, this.url);
const filepath = Utils.normalizeProxyUrlFile(app, url);
this.set('Content-Type', proxyMapping[ext]);
const content = yield app.webpack.fileSystem.readWebpackMemoryFile(filepath, this.url, 'web');
const content = yield app.webpack.fileSystem.readWebpackMemoryFile(filepath, url, 'web');
if (content) {
this.body = content;
} else {
Expand Down

0 comments on commit c084e72

Please sign in to comment.