| 87 | } |
| 88 | |
| 89 | public insert(harRequest: Entry, content: string): boolean { |
| 90 | if (!isValidRequest(harRequest, content)) return false; |
| 91 | harRequest.request.url = decodeUriComponent(harRequest.request.url); |
| 92 | const responseBody: JSONType = parseJSON(content); |
| 93 | const result = upsert({ |
| 94 | harRequest, |
| 95 | responseBody, |
| 96 | store: this.store, |
| 97 | options: this.storeOptions, |
| 98 | }); |
| 99 | if (!result) return false; |
| 100 | const { insertedPath, insertedLeaf, insertedHost } = result; |
| 101 | insertLeafMap({ |
| 102 | leafMap: this.leafMap, |
| 103 | host: insertedHost, |
| 104 | leaf: insertedLeaf, |
| 105 | path: insertedPath, |
| 106 | }); |
| 107 | let pathname = insertedPath; |
| 108 | for (const idx of fastPathParameterIndices(pathname)) { |
| 109 | const newPathname = this.parameterise(idx, pathname, insertedHost); |
| 110 | if (newPathname) pathname = newPathname; |
| 111 | } |
| 112 | return true; |
| 113 | } |
| 114 | |
| 115 | public parameterise( |
| 116 | index: number, |