]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/request/node_modules/har-validator/README.md
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / request / node_modules / har-validator / README.md
1 # HAR Validator [![version][npm-version]][npm-url] [![License][npm-license]][license-url]
2
3 Extremely fast HTTP Archive ([HAR](http://www.softwareishard.com/blog/har-12-spec/)) validator using JSON Schema.
4
5 [![Build Status][travis-image]][travis-url]
6 [![Downloads][npm-downloads]][npm-url]
7 [![Code Climate][codeclimate-quality]][codeclimate-url]
8 [![Coverage Status][codeclimate-coverage]][codeclimate-url]
9 [![Dependencies][david-image]][david-url]
10
11 ## Install
12
13 ```shell
14 # to use in cli
15 npm install --global har-validator
16
17 # to use as a module
18 npm install --save har-validator
19 ```
20
21 ## Usage
22
23 ```
24
25   Usage: har-validator [options] <files ...>
26
27   Options:
28
29     -h, --help           output usage information
30     -V, --version        output the version number
31     -s, --schema [name]  validate schema name (log, request, response, etc ...)
32
33 ```
34
35 ###### Example
36
37 ```shell
38 har-validator har.json
39
40 har-validator --schema request request.json
41 ```
42
43 ## API
44
45 **Note**: as of [`v2.0.0`](https://github.com/ahmadnassri/har-validator/releases/tag/v2.0.0) this module defaults to Promise based API. *For backward comptability with `v1.x` an [async/callback API](#callback-api) is provided*
46
47 ### Validate(data)
48
49 > Returns a promise that resolves to the valid object.
50
51 - **data**: `Object` *(Required)*
52   a full [HAR](http://www.softwareishard.com/blog/har-12-spec/) object
53
54 ```js
55 validate(data)
56   .then(data => console.log('horray!'))
57   .catch(console.error)
58 ```
59
60 ### Validate.log(data)
61
62 > Returns a promise that resolves to the valid object.
63
64 - **data**: `Object` *(Required)*
65   a [log](http://www.softwareishard.com/blog/har-12-spec/#log) object
66
67 ```js
68 validate.log(data)
69   .then(data => console.log('horray!'))
70   .catch(console.error)
71 ```
72
73 ### Validate.cache(data)
74
75 > Returns a promise that resolves to the valid object.
76
77 - **data**: `Object` *(Required)*
78   a [cache](http://www.softwareishard.com/blog/har-12-spec/#cache) object
79
80 ```js
81 validate.cache(data)
82   .then(data => console.log('horray!'))
83   .catch(console.error)
84 ```
85
86 ### Validate.cacheEntry(data)
87
88 > Returns a promise that resolves to the valid object.
89
90 - **data**: `Object` *(Required)*
91   a ["beforeRequest" or "afterRequest"](http://www.softwareishard.com/blog/har-12-spec/#cache) objects
92
93 ```js
94 validate.cacheEntry(data)
95   .then(data => console.log('horray!'))
96   .catch(console.error)
97 ```
98
99 ### Validate.content(data)
100
101 > Returns a promise that resolves to the valid object.
102
103 - **data**: `Object` *(Required)*
104   a [content](http://www.softwareishard.com/blog/har-12-spec/#content) object
105
106 ```js
107 validate.content(data)
108   .then(data => console.log('horray!'))
109   .catch(console.error)
110 ```
111
112 ### Validate.cookie(data)
113
114 > Returns a promise that resolves to the valid object.
115
116 - **data**: `Object` *(Required)*
117   a [cookie](http://www.softwareishard.com/blog/har-12-spec/#cookies) object
118
119 ```js
120 validate.cookie(data)
121   .then(data => console.log('horray!'))
122   .catch(console.error)
123 ```
124
125 ### Validate.creator(data)
126
127 > Returns a promise that resolves to the valid object.
128
129 - **data**: `Object` *(Required)*
130   a [creator](http://www.softwareishard.com/blog/har-12-spec/#creator) object
131
132 ```js
133 validate.creator(data)
134   .then(data => console.log('horray!'))
135   .catch(console.error)
136 ```
137
138 ### Validate.entry(data)
139
140 > Returns a promise that resolves to the valid object.
141
142 - **data**: `Object` *(Required)*
143   an [entry](http://www.softwareishard.com/blog/har-12-spec/#entries) object
144
145 ```js
146 validate.entry(data)
147   .then(data => console.log('horray!'))
148   .catch(console.error)
149 ```
150
151 ### Validate.log(data)
152
153 alias of [`Validate(data)`](#validate-data-callback-)
154
155 ### Validate.page(data)
156
157 > Returns a promise that resolves to the valid object.
158
159 - **data**: `Object` *(Required)*
160   a [page](http://www.softwareishard.com/blog/har-12-spec/#pages) object
161
162 ```js
163 validate.page(data)
164   .then(data => console.log('horray!'))
165   .catch(console.error)
166 ```
167
168 ### Validate.pageTimings(data)
169
170 > Returns a promise that resolves to the valid object.
171
172 - **data**: `Object` *(Required)*
173   a [pageTimings](http://www.softwareishard.com/blog/har-12-spec/#pageTimings) object
174
175 ```js
176 validate.pageTimings(data)
177   .then(data => console.log('horray!'))
178   .catch(console.error)
179 ```
180
181 ### Validate.postData(data)
182
183 > Returns a promise that resolves to the valid object.
184
185 - **data**: `Object` *(Required)*
186   a [postData](http://www.softwareishard.com/blog/har-12-spec/#postData) object
187
188 ```js
189 validate.postData(data)
190   .then(data => console.log('horray!'))
191   .catch(console.error)
192 ```
193
194 ### Validate.record(data)
195
196 > Returns a promise that resolves to the valid object.
197
198 - **data**: `Object` *(Required)*
199   a [record](http://www.softwareishard.com/blog/har-12-spec/#headers) object
200
201 ```js
202 validate.record(data)
203   .then(data => console.log('horray!'))
204   .catch(console.error)
205 ```
206
207 ### Validate.request(data)
208
209 > Returns a promise that resolves to the valid object.
210
211 - **data**: `Object` *(Required)*
212   a [request](http://www.softwareishard.com/blog/har-12-spec/#request) object
213
214 ```js
215 validate.request(data)
216   .then(data => console.log('horray!'))
217   .catch(console.error)
218 ```
219
220 ### Validate.response(data)
221
222 > Returns a promise that resolves to the valid object.
223
224 - **data**: `Object` *(Required)*
225   a [response](http://www.softwareishard.com/blog/har-12-spec/#response) object
226
227 ```js
228 validate.cacheEntry(data)
229   .then(data => console.log('horray!'))
230   .catch(console.error)
231 ```
232
233 ### Validate.timings(data)
234
235 > Returns a promise that resolves to the valid object.
236
237 - **data**: `Object` *(Required)*
238   a [timings](http://www.softwareishard.com/blog/har-12-spec/#timings) object
239
240 ```js
241 validate.timings(data)
242   .then(data => console.log('horray!'))
243   .catch(console.error)
244 ```
245
246 ----
247
248 ## Callback API
249
250 ### Validate(data [, callback])
251
252 > Returns `true` or `false`.
253
254 ```js
255 var HAR = require('./har.json');
256 var validate = require('har-validator/lib/async');
257
258 validate(HAR, function (e, valid) {
259   if (e) console.log(e.errors)
260
261   if (valid) console.log('horray!');
262 });
263
264 ```
265 The async API provides exactly the same methods as the [Promise API](#promise-api)
266
267 ----
268
269 ## Support
270
271 Donations are welcome to help support the continuous development of this project.
272
273 [![Gratipay][gratipay-image]][gratipay-url]
274 [![PayPal][paypal-image]][paypal-url]
275 [![Flattr][flattr-image]][flattr-url]
276 [![Bitcoin][bitcoin-image]][bitcoin-url]
277
278 ## License
279
280 [ISC License](LICENSE) &copy; [Ahmad Nassri](https://www.ahmadnassri.com/)
281
282 [license-url]: https://github.com/ahmadnassri/har-validator/blob/master/LICENSE
283
284 [travis-url]: https://travis-ci.org/ahmadnassri/har-validator
285 [travis-image]: https://img.shields.io/travis/ahmadnassri/har-validator.svg?style=flat-square
286
287 [npm-url]: https://www.npmjs.com/package/har-validator
288 [npm-license]: https://img.shields.io/npm/l/har-validator.svg?style=flat-square
289 [npm-version]: https://img.shields.io/npm/v/har-validator.svg?style=flat-square
290 [npm-downloads]: https://img.shields.io/npm/dm/har-validator.svg?style=flat-square
291
292 [codeclimate-url]: https://codeclimate.com/github/ahmadnassri/har-validator
293 [codeclimate-quality]: https://img.shields.io/codeclimate/github/ahmadnassri/har-validator.svg?style=flat-square
294 [codeclimate-coverage]: https://img.shields.io/codeclimate/coverage/github/ahmadnassri/har-validator.svg?style=flat-square
295
296 [david-url]: https://david-dm.org/ahmadnassri/har-validator
297 [david-image]: https://img.shields.io/david/ahmadnassri/har-validator.svg?style=flat-square
298
299 [gratipay-url]: https://www.gratipay.com/ahmadnassri/
300 [gratipay-image]: https://img.shields.io/gratipay/ahmadnassri.svg?style=flat-square
301
302 [paypal-url]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UJ2B2BTK9VLRS&on0=project&os0=har-validator
303 [paypal-image]: http://img.shields.io/badge/paypal-donate-green.svg?style=flat-square
304
305 [flattr-url]: https://flattr.com/submit/auto?user_id=ahmadnassri&url=https://github.com/ahmadnassri/har-validator&title=har-validator&language=&tags=github&category=software
306 [flattr-image]: http://img.shields.io/badge/flattr-donate-green.svg?style=flat-square
307
308 [bitcoin-image]: http://img.shields.io/badge/bitcoin-1Nb46sZRVG3or7pNaDjthcGJpWhvoPpCxy-green.svg?style=flat-square
309 [bitcoin-url]: https://www.coinbase.com/checkouts/ae383ae6bb931a2fa5ad11cec115191e?name=har-validator