| 32 | }; |
| 33 | |
| 34 | export class Request { |
| 35 | private _resourceType: string; |
| 36 | private _data: any; |
| 37 | private _mimeType: string; |
| 38 | |
| 39 | constructor( |
| 40 | private _networkDomainDebugger: NetworkDomainDebugger, |
| 41 | private _requestID: string, |
| 42 | ) {} |
| 43 | |
| 44 | get mimeType(): string { |
| 45 | return this._mimeType; |
| 46 | } |
| 47 | |
| 48 | set mimeType(value: string) { |
| 49 | if (this._mimeType !== value) { |
| 50 | if (!value) { |
| 51 | this._mimeType = 'text/plain'; |
| 52 | this._resourceType = 'Other'; |
| 53 | |
| 54 | return; |
| 55 | } |
| 56 | |
| 57 | this._mimeType = value; |
| 58 | |
| 59 | let resourceType = 'Other'; |
| 60 | |
| 61 | if (this._mimeType in documentTypeByMimeType) { |
| 62 | resourceType = documentTypeByMimeType[this._mimeType]; |
| 63 | } |
| 64 | |
| 65 | if (this._mimeType.indexOf('image/') !== -1) { |
| 66 | resourceType = 'Image'; |
| 67 | } |
| 68 | |
| 69 | if (this._mimeType.indexOf('font/') !== -1) { |
| 70 | resourceType = 'Font'; |
| 71 | } |
| 72 | |
| 73 | this._resourceType = resourceType; |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | get requestID(): string { |
| 78 | return this._requestID; |
| 79 | } |
| 80 | |
| 81 | get hasTextContent(): boolean { |
| 82 | return ['Document', 'Stylesheet', 'Script', 'XHR'].indexOf(this._resourceType) !== -1; |
| 83 | } |
| 84 | |
| 85 | get data(): any { |
| 86 | return this._data; |
| 87 | } |
| 88 | |
| 89 | set data(value: any) { |
| 90 | if (this._data !== value) { |
| 91 | this._data = value; |
nothing calls this directly
no outgoing calls
no test coverage detected