()
| 178 | } |
| 179 | |
| 180 | dehydrate(): DehydratedCache { |
| 181 | const dehydrated: DehydratedCache = {}; |
| 182 | Array.from(this.cache.keys()).forEach((url) => { |
| 183 | const resp = this.cache.get(url) as MockResponse; |
| 184 | const dehydratedResp = { |
| 185 | body: resp._body, |
| 186 | status: resp.status, |
| 187 | statusText: resp.statusText, |
| 188 | headers: {}, |
| 189 | } as DehydratedResponse; |
| 190 | |
| 191 | resp.headers.forEach((value: string, name: string) => { |
| 192 | dehydratedResp.headers[name] = value; |
| 193 | }); |
| 194 | |
| 195 | dehydrated[url] = dehydratedResp; |
| 196 | }); |
| 197 | return dehydrated; |
| 198 | } |
| 199 | |
| 200 | /** Get the normalized URL from a `RequestInfo` value. */ |
| 201 | private getRequestUrl(request: RequestInfo): string { |
no test coverage detected