Skip to content

Commit

Permalink
Fix no URI breaking page
Browse files Browse the repository at this point in the history
  • Loading branch information
pasu authored and pasu committed Dec 14, 2020
1 parent 612a080 commit b461595
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions devtools/devtools.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
let extPanelWindow = null;
let cureentStatus = 'Stopped';
const SPECIAL_CASE_URL = {
NO_URI: '~NO_URI~'
}

chrome.devtools.panels.create("Response Override",
"../images/icon.png",
Expand All @@ -12,7 +15,7 @@ function getHeaderString(headers) {
let responseHeader = '';
headers.forEach((header, key) => {
responseHeader += key + ':' + header + '\n';
})
});
return responseHeader;
}

Expand Down Expand Up @@ -41,9 +44,15 @@ function replaceResponse(response, filteredData, callback) {
callback(response)
}
function checkURLTagged(url, replaceData) {
return replaceData.filter(replaceDatum => url.includes(replaceDatum.url));
return replaceData.filter(replaceDatum => {
if (replaceDatum.url === SPECIAL_CASE_URL.NO_URI) {
return new URL(url).pathname === '/';
}
return url.includes(replaceDatum.url);
});
}


function submitResponse(filteredData, continueParams) {
let responseLines = [];
if (filteredData.contentType) {
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Chrome Response Override",
"short_name": "Chrome Response Override",
"version": "1.5",
"version": "1.6",
"description": "Provides support to override API/HTML/* response using simple Find & Replace steps. No external app installation required",
"author": "Pasupathi Rajamanickam",
"devtools_page": "devtools/devtools.html",
Expand Down

0 comments on commit b461595

Please sign in to comment.