Allow null for cache data, according to HAR spec.

The HAR spec allows for afterRequest and beforeRequest to be null, see
http://www.softwareishard.com/blog/har-12-spec/#cache. This has a different semantics from the fields being left out.
This commit is contained in:
Tobias Lidskog
2018-02-17 13:57:24 +01:00
parent 480cab7dcb
commit 25103578d8
2 changed files with 15 additions and 2 deletions
+13
View File
@@ -89,6 +89,19 @@ const testEntry: harFormat.Entry = {
pageref: "page_1"
};
// Examples from http://www.softwareishard.com/blog/har-12-spec/#cache
const testCacheNoInformation: harFormat.Cache = {
};
const testNoCacheAfter: harFormat.Cache = {
afterRequest: null
};
const testCacheNotCached: harFormat.Cache = {
beforeRequest: null,
afterRequest: null
};
const testLog: harFormat.Log = {
version: "1.2",
creator: testCreator,
+2 -2
View File
@@ -728,13 +728,13 @@ export interface Cache {
*
* Leave out this field if the information is not available.
*/
beforeRequest?: CacheDetails;
beforeRequest?: CacheDetails | null;
/**
* State of a cache entry after the request.
*
* Leave out this field if the information is not available.
*/
afterRequest?: CacheDetails;
afterRequest?: CacheDetails | null;
/** A comment provided by the user or the application */
comment?: string;
}