From 21fe4fe38cd514a3f01ef6b307bfc8421ed090c1 Mon Sep 17 00:00:00 2001 From: Jon Ursenbach Date: Wed, 1 Dec 2021 11:19:42 -0800 Subject: [PATCH] feat: refactoring the root index to no longer require `fs` --- .eslintignore | 1 + .npmignore | 1 + .prettierignore | 1 + __tests__/index.test.js | 6 + build.js | 22 + index.js | 879 +++++++++++++++++++++++++++++++++++++++- package.json | 1 + 7 files changed, 899 insertions(+), 12 deletions(-) create mode 100755 build.js diff --git a/.eslintignore b/.eslintignore index c4ff428..83bbdc6 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,4 @@ coverage/ node_modules/ src/*.har +index.js diff --git a/.npmignore b/.npmignore index dd60d50..c9fd889 100644 --- a/.npmignore +++ b/.npmignore @@ -3,3 +3,4 @@ __tests__/ coverage/ .eslint* .prettier* +build.js diff --git a/.prettierignore b/.prettierignore index 038e30c..ca32d42 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,3 @@ coverage/ src/*.har +index.js diff --git a/__tests__/index.test.js b/__tests__/index.test.js index 82ffd59..2f1e302 100644 --- a/__tests__/index.test.js +++ b/__tests__/index.test.js @@ -3,6 +3,12 @@ const toBeAValidHAR = require('jest-expect-har').default; expect.extend({ toBeAValidHAR }); +test('root export should load', () => { + // eslint-disable-next-line global-require + const root = require('..'); + expect(root['application-json']).toBeDefined(); +}); + test('export should contain HARs', () => { expect(Object.keys(hars).length).toBeGreaterThan(0); }); diff --git a/build.js b/build.js new file mode 100755 index 0000000..abef490 --- /dev/null +++ b/build.js @@ -0,0 +1,22 @@ +#!/usr/bin/env node +const path = require('path'); +const fs = require('fs'); + +(async () => { + const out = {}; + const files = await fs.readdirSync(path.join(__dirname, './src')); + + files + .filter(har => { + return har.indexOf('.har') !== -1; + }) + .forEach(har => { + out[har.replace('.har', '')] = JSON.parse(fs.readFileSync(path.join(__dirname, `./src/${har}`), 'utf8')); + }); + + const build = `// This file is autogenerated. Run \`npm run build\` to update it. + +module.exports = ${JSON.stringify(out, undefined, 2)};`; + + fs.writeFileSync('index.js', build); +})(); diff --git a/index.js b/index.js index ca27b51..1cbd6b6 100644 --- a/index.js +++ b/index.js @@ -1,13 +1,868 @@ -const fs = require('fs'); -const path = require('path'); +// This file is autogenerated. Run `npm run build` to update it. -const exp = {}; -fs.readdirSync(path.join(__dirname, './src')) - .filter(har => { - return har.indexOf('.har') !== -1; - }) - .forEach(har => { - exp[har.replace('.har', '')] = JSON.parse(fs.readFileSync(path.join(__dirname, `./src/${har}`), 'utf8')); - }); - -module.exports = exp; +module.exports = { + "application-form-encoded": { + "log": { + "entries": [ + { + "startedDateTime": "2021-07-09T23:28:52.627Z", + "time": 209, + "request": { + "method": "POST", + "url": "https://httpbin.org/post", + "httpVersion": "HTTP/1.1", + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/x-www-form-urlencoded" + } + ], + "queryString": [], + "postData": { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "foo", + "value": "bar" + }, + { + "name": "hello", + "value": "world" + } + ] + }, + "bodySize": -1, + "headersSize": -1 + }, + "response": { + "status": 200, + "statusText": "OK", + "httpVersion": "HTTP/1.1", + "headers": [ + { + "name": "Content-Type", + "value": "application/json" + }, + { + "name": "Content-Length", + "value": 597 + } + ], + "content": { + "size": 597, + "mimeType": "application/json", + "text": "{\"args\":{},\"data\":\"\",\"files\":{},\"form\":{\"foo\":\"bar\",\"hello\":\"world\"},\"headers\":{\"Accept\":\"*/*\",\"Accept-Encoding\":\"gzip, deflate, br\",\"Cache-Control\":\"no-cache\",\"Content-Length\":\"19\",\"Content-Type\":\"application/x-www-form-urlencoded\",\"Host\":\"httpbin.org\"},\"json\":null,\"origin\":\"127.0.0.1\",\"url\":\"http://httpbin.org/post\"}" + }, + "headersSize": -1, + "bodySize": -1 + } + } + ] + } + }, + "application-json": { + "log": { + "entries": [ + { + "startedDateTime": "2021-07-09T23:28:52.627Z", + "time": 198, + "request": { + "method": "POST", + "url": "https://httpbin.org/post", + "httpVersion": "HTTP/1.1", + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "queryString": [], + "postData": { + "mimeType": "application/json", + "text": "{\"number\":1,\"string\":\"f\\\"oo\",\"arr\":[1,2,3],\"nested\":{\"a\":\"b\"},\"arr_mix\":[1,\"a\",{\"arr_mix_nested\":{}}],\"boolean\":false}" + }, + "bodySize": -1, + "headersSize": -1 + }, + "response": { + "status": 200, + "statusText": "OK", + "httpVersion": "HTTP/1.1", + "headers": [ + { + "name": "Content-Type", + "value": "application/json" + }, + { + "name": "Content-Length", + "value": 1082 + } + ], + "content": { + "size": 597, + "mimeType": "application/json", + "text": "{\"args\":{},\"data\":\"{\\n \\\"number\\\": 1,\\n \\\"string\\\": \\\"f\\\\\\\"oo\\\",\\n \\\"arr\\\": [\\n 1,\\n 2,\\n 3\\n ],\\n \\\"nested\\\": {\\n \\\"a\\\": \\\"b\\\"\\n },\\n \\\"arr_mix\\\": [\\n 1,\\n \\\"a\\\",\\n {\\n \\\"arr_mix_nested\\\": {}\\n }\\n ],\\n \\\"boolean\\\": false\\n}\",\"files\":{},\"form\":{},\"headers\":{\"Accept\":\"*/*\",\"Accept-Encoding\":\"gzip, deflate, br\",\"Cache-Control\":\"no-cache\",\"Content-Length\":\"257\",\"Content-Type\":\"application/json\",\"Host\":\"httpbin.org\"},\"json\":{\"arr\":[1,2,3],\"arr_mix\":[1,\"a\",{\"arr_mix_nested\":{}}],\"boolean\":false,\"nested\":{\"a\":\"b\"},\"number\":1,\"string\":\"f\\\"oo\"},\"origin\":\"127.0.0.1\",\"url\":\"http://httpbin.org/post\"}" + }, + "headersSize": -1, + "bodySize": -1 + } + } + ] + } + }, + "cookies": { + "log": { + "entries": [ + { + "startedDateTime": "2021-07-09T23:28:52.627Z", + "time": 89, + "request": { + "method": "GET", + "url": "https://httpbin.org/cookies", + "httpVersion": "HTTP/1.1", + "cookies": [ + { + "name": "foo", + "value": "bar" + }, + { + "name": "bar", + "value": "baz" + } + ], + "headers": [], + "queryString": [], + "bodySize": -1, + "headersSize": -1 + }, + "response": { + "status": 200, + "statusText": "OK", + "httpVersion": "HTTP/1.1", + "headers": [ + { + "name": "Content-Type", + "value": "application/json" + }, + { + "name": "Content-Length", + "value": 59 + } + ], + "content": { + "size": 59, + "mimeType": "application/json", + "text": "{\"cookies\":{\"bar\":\"baz\",\"foo\":\"bar\"}}" + }, + "headersSize": -1, + "bodySize": -1 + } + } + ] + } + }, + "full": { + "log": { + "entries": [ + { + "startedDateTime": "2021-07-09T23:28:52.627Z", + "time": 88, + "request": { + "method": "POST", + "url": "https://httpbin.org/post?key=value", + "httpVersion": "HTTP/1.1", + "cookies": [ + { + "name": "foo", + "value": "bar" + }, + { + "name": "bar", + "value": "baz" + } + ], + "headers": [ + { + "name": "accept", + "value": "application/json" + }, + { + "name": "content-type", + "value": "application/x-www-form-urlencoded" + } + ], + "queryString": [ + { + "name": "foo", + "value": "bar" + }, + { + "name": "foo", + "value": "baz" + }, + { + "name": "baz", + "value": "abc" + } + ], + "postData": { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "foo", + "value": "bar" + } + ] + }, + "bodySize": -1, + "headersSize": -1 + }, + "response": { + "status": 200, + "statusText": "OK", + "httpVersion": "HTTP/1.1", + "headers": [ + { + "name": "Content-Type", + "value": "application/json" + }, + { + "name": "Content-Length", + "value": 744 + } + ], + "content": { + "size": 744, + "mimeType": "application/json", + "text": "{\"args\":{\"baz\":\"abc\",\"foo\":[\"bar\",\"baz\"],\"key\":\"value\"},\"data\":\"\",\"files\":{},\"form\":{\"foo\":\"bar\"},\"headers\":{\"Accept\":\"application/json\",\"Accept-Encoding\":\"gzip, deflate, br\",\"Cache-Control\":\"no-cache\",\"Content-Length\":\"7\",\"Content-Type\":\"application/x-www-form-urlencoded\",\"Cookie\":\"bar=baz; foo=bar\",\"Host\":\"httpbin.org\"},\"json\":null,\"origin\":\"127.0.0.1\",\"url\":\"https://httpbin.org/post?key=value&foo=bar&foo=baz&baz=abc\"}" + }, + "headersSize": -1, + "bodySize": -1 + } + } + ] + } + }, + "headers": { + "log": { + "entries": [ + { + "startedDateTime": "2021-07-09T23:28:52.627Z", + "time": 491, + "request": { + "method": "GET", + "url": "https://httpbin.org/get", + "httpVersion": "HTTP/1.1", + "cookies": [], + "headers": [ + { + "name": "accept", + "value": "application/json" + }, + { + "name": "x-foo", + "value": "Bar" + } + ], + "queryString": [], + "bodySize": -1, + "headersSize": -1 + }, + "response": { + "status": 200, + "statusText": "OK", + "httpVersion": "HTTP/1.1", + "headers": [ + { + "name": "Content-Type", + "value": "application/json" + }, + { + "name": "Content-Length", + "value": 473 + } + ], + "content": { + "size": 473, + "mimeType": "application/json", + "text": "{\"args\":{},\"headers\":{\"Accept\":\"application/json\",\"Accept-Encoding\":\"gzip, deflate, br\",\"Cache-Control\":\"no-cache\",\"Host\":\"httpbin.org\",\"X-Foo\":\"Bar\"},\"origin\":\"127.0.0.1\",\"url\":\"https://httpbin.org/get\"}" + }, + "headersSize": -1, + "bodySize": -1 + } + } + ] + } + }, + "https": { + "log": { + "entries": [ + { + "startedDateTime": "2021-07-09T23:28:52.627Z", + "time": 91, + "request": { + "method": "GET", + "url": "https://httpbin.org/status/200", + "httpVersion": "HTTP/1.1", + "cookies": [], + "headers": [], + "queryString": [], + "bodySize": -1, + "headersSize": -1 + }, + "response": { + "status": 200, + "statusText": "OK", + "httpVersion": "HTTP/1.1", + "headers": [ + { + "name": "Content-Type", + "value": "text/html; charset=utf-8" + }, + { + "name": "Content-Length", + "value": 0 + } + ], + "content": { + "size": 0, + "mimeType": "text/html; charset=utf-8", + "text": "" + }, + "headersSize": -1, + "bodySize": -1 + } + } + ] + } + }, + "jsonObj-multiline": { + "log": { + "entries": [ + { + "startedDateTime": "2021-07-09T23:28:52.627Z", + "time": 87, + "request": { + "method": "POST", + "url": "https://httpbin.org/post", + "httpVersion": "HTTP/1.1", + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "queryString": [], + "postData": { + "text": "{\n \"foo\": \"bar\"\n}", + "mimeType": "application/json" + }, + "bodySize": -1, + "headersSize": -1 + }, + "response": { + "status": 200, + "statusText": "OK", + "httpVersion": "HTTP/1.1", + "headers": [ + { + "name": "Content-Type", + "value": "application/json" + }, + { + "name": "Content-Length", + "value": 609 + } + ], + "content": { + "size": 609, + "mimeType": "application/json", + "text": "{\"args\":{},\"data\":\"{\\\"foo\\\": \\\"bar\\\"}\",\"files\":{},\"form\":{},\"headers\":{\"Accept\":\"*/*\",\"Accept-Encoding\":\"gzip, deflate, br\",\"Cache-Control\":\"no-cache\",\"Content-Length\":\"14\",\"Content-Type\":\"application/json\",\"Host\":\"httpbin.org\"},\"json\":{\"foo\":\"bar\"},\"origin\":\"127.0.0.1\",\"url\":\"https://httpbin.org/post\"}" + }, + "headersSize": -1, + "bodySize": -1 + } + } + ] + } + }, + "jsonObj-null-value": { + "log": { + "entries": [ + { + "startedDateTime": "2021-07-09T23:28:52.627Z", + "time": 293, + "request": { + "method": "POST", + "url": "https://httpbin.org/post", + "httpVersion": "HTTP/1.1", + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "queryString": [], + "postData": { + "params": [], + "text": "{\"foo\":null}", + "mimeType": "application/json" + }, + "bodySize": -1, + "headersSize": -1 + }, + "response": { + "status": 200, + "statusText": "OK", + "httpVersion": "HTTP/1.1", + "headers": [ + { + "name": "Content-Type", + "value": "application/json" + }, + { + "name": "Content-Length", + "value": 605 + } + ], + "content": { + "size": 605, + "mimeType": "application/json", + "text": "{\"args\":{},\"data\":\"{\\\"foo\\\": null}\",\"files\":{},\"form\":{},\"headers\":{\"Accept\":\"*/*\",\"Accept-Encoding\":\"gzip, deflate, br\",\"Cache-Control\":\"no-cache\",\"Content-Length\":\"13\",\"Content-Type\":\"application/json\"},\"json\":{\"foo\":null},\"origin\":\"127.0.0.1\",\"url\":\"https://httpbin.org/post\"}" + }, + "headersSize": -1, + "bodySize": -1 + } + } + ] + } + }, + "multipart-data-dataurl": { + "log": { + "entries": [ + { + "startedDateTime": "2021-07-09T23:28:52.627Z", + "time": 293, + "request": { + "method": "POST", + "url": "https://httpbin.org/post", + "httpVersion": "HTTP/1.1", + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "multipart/form-data" + } + ], + "queryString": [], + "postData": { + "mimeType": "multipart/form-data", + "params": [ + { + "name": "foo", + "value": "data:image/png;name=owlbert.png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAMCAYAAABbayygAAABV0lEQVR4AWNwL/Bh0FGQ9FWUENUGsZExPz8/h5gArzmIDRZw1VfpSfeyagIJgiRBYkCg7mOl72akIt0KVwhSVB5o9SPESutJWajzquJgx/lRDganc7zNX3obq9SiKKxN8P/fmB33vybc7j+MHe1k8t9RSy4NrrA4K2Xp1k0b/peUlPzPjfL5v3bpgv9NTc3/48JD/sOsBju4JDnq6MS+3v9uLlb/pzeY/l82r+9/cIA/GNtrK2wFqQH7uDzY/gXQOrBpbemi/xO9DH4B2WCrQe4GqWHQVRDfBnLXpDTX/z3xTii4xM/if4iF5n+QGgZjZamvIIH5RT5wPKvQC0wDDQAr1FMQ/8YgK8zfAzIeqgCOp+V5gBW6Giq9A6kB+9pUXTiqINjwJ9B6uKKmBHuwW7XkhFeAYg2sMMWXQTvJh/2Uu6nciTgXvVsg7Gsp+xAkZqHPIA1SAwCKnrxJusHahgAAAABJRU5ErkJggg==", + "fileName": "owlbert.png", + "contentType": "image/png" + } + ] + }, + "bodySize": -1, + "headersSize": -1 + }, + "response": { + "status": 200, + "statusText": "OK", + "httpVersion": "HTTP/1.1", + "headers": [ + { + "name": "Content-Type", + "value": "application/json" + }, + { + "name": "Content-Length", + "value": 1195 + } + ], + "content": { + "size": 1195, + "mimeType": "application/json", + "text": "{\"args\":{},\"data\":\"\",\"files\":{},\"form\":{\"foo\":\"data:image/png;name=owlbert.png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAMCAYAAABbayygAAABV0lEQVR4AWNwL/Bh0FGQ9FWUENUGsZExPz8/h5gArzmIDRZw1VfpSfeyagIJgiRBYkCg7mOl72akIt0KVwhSVB5o9SPESutJWajzquJgx/lRDganc7zNX3obq9SiKKxN8P/fmB33vybc7j+MHe1k8t9RSy4NrrA4K2Xp1k0b/peUlPzPjfL5v3bpgv9NTc3/48JD/sOsBju4JDnq6MS+3v9uLlb/pzeY/l82r+9/cIA/GNtrK2wFqQH7uDzY/gXQOrBpbemi/xO9DH4B2WCrQe4GqWHQVRDfBnLXpDTX/z3xTii4xM/if4iF5n+QGgZjZamvIIH5RT5wPKvQC0wDDQAr1FMQ/8YgK8zfAzIeqgCOp+V5gBW6Giq9A6kB+9pUXTiqINjwJ9B6uKKmBHuwW7XkhFeAYg2sMMWXQTvJh/2Uu6nciTgXvVsg7Gsp+xAkZqHPIA1SAwCKnrxJusHahgAAAABJRU5ErkJggg==\"},\"headers\":{\"Accept\":\"*/*\",\"Accept-Encoding\":\"gzip, deflate, br\",\"Cache-Control\":\"no-cache\",\"Content-Length\":\"733\",\"Content-Type\":\"multipart/form-data; boundary=--------------------------107970116941825506485360\",\"Host\":\"httpbin.org\"},\"json\":null,\"origin\":\"127.0.0.1\",\"url\":\"https://httpbin.org/post\"}" + }, + "headersSize": -1, + "bodySize": -1 + } + } + ] + } + }, + "multipart-data": { + "log": { + "entries": [ + { + "startedDateTime": "2021-07-09T23:28:52.627Z", + "time": 424, + "request": { + "method": "POST", + "url": "https://httpbin.org/post", + "httpVersion": "HTTP/1.1", + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "multipart/form-data" + } + ], + "queryString": [], + "postData": { + "mimeType": "multipart/form-data", + "params": [ + { + "name": "foo", + "value": "Hello World", + "fileName": "hello.txt", + "contentType": "text/plain" + } + ] + }, + "bodySize": -1, + "headersSize": -1 + }, + "response": { + "status": 200, + "statusText": "OK", + "httpVersion": "HTTP/1.1", + "headers": [ + { + "name": "Content-Type", + "value": "application/json" + }, + { + "name": "Content-Length", + "value": 631 + } + ], + "content": { + "size": 631, + "mimeType": "application/json", + "text": "{\"args\":{},\"data\":\"\",\"files\":{},\"form\":{\"foo\":\"Hello World\"},\"headers\":{\"Accept\":\"*/*\",\"Accept-Encoding\":\"gzip, deflate, br\",\"Cache-Control\":\"no-cache\",\"Content-Length\":\"169\",\"Content-Type\":\"multipart/form-data; boundary=--------------------------222368256563853246313607\",\"Host\":\"httpbin.org\"},\"json\":null,\"origin\":\"127.0.0.1\",\"url\":\"https://httpbin.org/post\"}" + }, + "headersSize": -1, + "bodySize": -1 + } + } + ] + } + }, + "multipart-file": { + "log": { + "entries": [ + { + "startedDateTime": "2021-07-09T23:28:52.627Z", + "time": 444, + "request": { + "method": "POST", + "url": "https://httpbin.org/post", + "httpVersion": "HTTP/1.1", + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "multipart/form-data" + } + ], + "queryString": [], + "postData": { + "mimeType": "multipart/form-data", + "params": [ + { + "name": "foo", + "fileName": "file/path/to/hello.txt", + "contentType": "text/plain" + } + ] + }, + "bodySize": -1, + "headersSize": -1 + }, + "response": { + "status": 200, + "statusText": "OK", + "httpVersion": "HTTP/1.1", + "headers": [ + { + "name": "Content-Type", + "value": "application/json" + }, + { + "name": "Content-Length", + "value": 633 + } + ], + "content": { + "size": 633, + "mimeType": "application/json", + "text": "{\"args\":{},\"data\":\"\",\"files\":{\"foo\":\"Hello world\\n\"},\"form\":{},\"headers\":{\"Accept\":\"*/*\",\"Accept-Encoding\":\"gzip, deflate, br\",\"Cache-Control\":\"no-cache\",\"Content-Length\":\"218\",\"Content-Type\":\"multipart/form-data; boundary=--------------------------196008684257091791409412\",\"Host\":\"httpbin.org\"},\"json\":null,\"origin\":\"127.0.0.1\",\"url\":\"https://httpbin.org/post\"}" + }, + "headersSize": -1, + "bodySize": -1 + } + } + ] + } + }, + "multipart-form-data": { + "log": { + "entries": [ + { + "startedDateTime": "2021-07-09T23:28:52.627Z", + "time": 420, + "request": { + "method": "POST", + "url": "https://httpbin.org/post", + "httpVersion": "HTTP/1.1", + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "multipart/form-data" + } + ], + "queryString": [], + "postData": { + "mimeType": "multipart/form-data", + "params": [ + { + "name": "foo", + "value": "bar" + } + ] + }, + "bodySize": -1, + "headersSize": -1 + }, + "response": { + "status": 200, + "statusText": "OK", + "httpVersion": "HTTP/1.1", + "headers": [ + { + "name": "Content-Type", + "value": "application/json" + }, + { + "name": "Content-Length", + "value": 623 + } + ], + "content": { + "size": 623, + "mimeType": "application/json", + "text": "{\"args\":{},\"data\":\"\",\"files\":{},\"form\":{\"foo\":\"bar\"},\"headers\":{\"Accept\":\"*/*\",\"Accept-Encoding\":\"gzip, deflate, br\",\"Cache-Control\":\"no-cache\",\"Content-Length\":\"161\",\"Content-Type\":\"multipart/form-data; boundary=--------------------------044968161040036542175169\",\"Host\":\"httpbin.org\"},\"json\":null,\"origin\":\"127.0.0.1\",\"url\":\"https://httpbin.org/post\"}" + }, + "headersSize": -1, + "bodySize": -1 + } + } + ] + } + }, + "query": { + "log": { + "entries": [ + { + "startedDateTime": "2021-07-09T23:28:52.627Z", + "time": 429, + "request": { + "method": "GET", + "url": "https://httpbin.org/get?key=value", + "httpVersion": "HTTP/1.1", + "cookies": [], + "headers": [], + "queryString": [ + { + "name": "foo", + "value": "bar" + }, + { + "name": "foo", + "value": "baz" + }, + { + "name": "baz", + "value": "abc" + } + ], + "bodySize": -1, + "headersSize": -1 + }, + "response": { + "status": 200, + "statusText": "OK", + "httpVersion": "HTTP/1.1", + "headers": [ + { + "name": "Content-Type", + "value": "application/json" + }, + { + "name": "Content-Length", + "value": 495 + } + ], + "content": { + "size": 495, + "mimeType": "application/json", + "text": "{\"args\":{\"baz\":\"abc\",\"foo\":[\"bar\",\"baz\"]},\"headers\":{\"Accept\":\"*/*\",\"Accept-Encoding\":\"gzip, deflate, br\",\"Cache-Control\":\"no-cache\",\"Host\":\"httpbin.org\"},\"origin\":\"127.0.0.1\",\"url\":\"https://httpbin.org/get?foo=bar&foo=baz&baz=abc\"}" + }, + "headersSize": -1, + "bodySize": -1 + } + } + ] + } + }, + "short": { + "log": { + "entries": [ + { + "startedDateTime": "2021-07-09T23:28:52.627Z", + "time": 85, + "request": { + "method": "GET", + "url": "https://httpbin.org/get", + "httpVersion": "HTTP/1.1", + "cookies": [], + "headers": [], + "queryString": [], + "bodySize": -1, + "headersSize": -1 + }, + "response": { + "status": 200, + "statusText": "OK", + "httpVersion": "HTTP/1.1", + "headers": [ + { + "name": "Content-Type", + "value": "application/json" + }, + { + "name": "Content-Length", + "value": 404 + } + ], + "content": { + "size": 404, + "mimeType": "application/json", + "text": "{\"args\":{},\"headers\":{\"Accept\":\"*/*\",\"Accept-Encoding\":\"gzip, deflate, br\",\"Cache-Control\":\"no-cache\",\"Host\":\"httpbin.org\"},\"origin\":\"127.0.0.1\",\"url\":\"https://httpbin.org/get\"}" + }, + "headersSize": -1, + "bodySize": -1 + } + } + ] + } + }, + "text-plain": { + "log": { + "entries": [ + { + "startedDateTime": "2021-07-09T23:28:52.627Z", + "time": 85, + "request": { + "method": "POST", + "url": "https://httpbin.org/post", + "httpVersion": "HTTP/1.1", + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "text/plain" + } + ], + "queryString": [], + "postData": { + "mimeType": "text/plain", + "text": "Hello World" + }, + "bodySize": -1, + "headersSize": -1 + }, + "response": { + "status": 200, + "statusText": "OK", + "httpVersion": "HTTP/1.1", + "headers": [ + { + "name": "Content-Type", + "value": "application/json" + }, + { + "name": "Content-Length", + "value": 543 + } + ], + "content": { + "size": 543, + "mimeType": "application/json", + "text": "{\"args\":{},\"data\":\"Hello World\",\"files\":{},\"form\":{},\"headers\":{\"Accept\":\"*/*\",\"Accept-Encoding\":\"gzip, deflate, br\",\"Cache-Control\":\"no-cache\",\"Content-Length\":\"11\",\"Content-Type\":\"text/plain\",\"Host\":\"httpbin.org\"},\"json\":null,\"origin\":\"127.0.0.1\",\"url\":\"https://httpbin.org/post\"}" + }, + "headersSize": -1, + "bodySize": -1 + } + } + ] + } + }, + "xml": { + "log": { + "entries": [ + { + "startedDateTime": "2021-07-09T23:28:52.627Z", + "time": 87, + "request": { + "method": "GET", + "url": "https://httpbin.org/xml", + "httpVersion": "HTTP/1.1", + "cookies": [], + "headers": [ + { + "name": "Accept", + "value": "application/xml" + } + ], + "queryString": [], + "bodySize": -1, + "headersSize": -1 + }, + "response": { + "status": 200, + "statusText": "OK", + "httpVersion": "HTTP/1.1", + "headers": [ + { + "name": "Content-Type", + "value": "application/xml" + }, + { + "name": "Content-Length", + "value": 522 + } + ], + "content": { + "size": 522, + "mimeType": "application/xml", + "text": "\n\n\n \n \n Wake up to WonderWidgets!\n \n \n \n Overview\n Why\n WonderWidgets are great\n \n \n Who\n buys WonderWidgets\n \n \n" + }, + "headersSize": -1, + "bodySize": -1 + } + } + ] + } + } +}; \ No newline at end of file diff --git a/package.json b/package.json index e41dfaa..9d7fd0e 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "node": "^12 || ^14 || ^16" }, "scripts": { + "build": "node ./build.js", "lint": "eslint .", "pretest": "npm run lint", "prettier": "prettier --list-different --write \"./**/**.js\"",