Skip to content

Commit 794e1d4

Browse files
committed
TypeScript debug fixed
1 parent 921d718 commit 794e1d4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tns-core-modules/debugger/webinspector.ios.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,15 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai
212212
* Loads a resource in the context of a frame on the inspected page without cross origin checks.
213213
*/
214214
loadResource(params: inspectorCommandTypes.NetworkDomain.LoadResourceMethodArguments): { content: string, mimeType: string, status: number } {
215+
let appPath = NSBundle.mainBundle().bundlePath;
216+
let pathUrl = params.url.replace("file://", appPath);
217+
let fileManager = NSFileManager.defaultManager();
218+
let data = fileManager.fileExistsAtPath(pathUrl) ? fileManager.contentsAtPath(pathUrl) : undefined;
219+
let content = data ? NSString.alloc().initWithDataEncoding(data, NSUTF8StringEncoding) : "";
220+
215221
return {
216-
content: "",
217-
mimeType: "",
222+
content: content.toString(), // Not sure why however we need to call toString() for NSString
223+
mimeType: "application/octet-stream",
218224
status: 200
219225
}
220226
}

0 commit comments

Comments
 (0)