feat: Created a mini nodeJS server with NewMan for testing without PostMan GUI.

This will mimic a run in a CD/CI environment or docker container.
This commit is contained in:
Simon Priet
2021-09-08 14:01:19 +02:00
parent 5fbd7c88fa
commit e69a613a37
5610 changed files with 740417 additions and 3 deletions

10
node_modules/mime-format/.editorconfig generated vendored Normal file
View File

@@ -0,0 +1,10 @@
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

32
node_modules/mime-format/.jsdoc-config.json generated vendored Normal file
View File

@@ -0,0 +1,32 @@
{
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc", "closure"]
},
"source": {
"include": ["index.js"],
"includePattern": ".+\\.js(doc)?$",
"excludePattern": "(^|\\/|\\\\)_"
},
"plugins": [],
"templates": {
"cleverLinks": false,
"monospaceLinks": false,
"highlightTutorialCode" : true
},
"opts": {
"template": "./node_modules/postman-jsdoc-theme",
"encoding": "utf8",
"destination": "./out/docs",
"recurse": true,
"readme": "README.md"
},
"markdown": {
"parser": "gfm",
"hardwrap": false
}
}

201
node_modules/mime-format/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2016, Postdot Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

71
node_modules/mime-format/README.md generated vendored Normal file
View File

@@ -0,0 +1,71 @@
# mime-format
Simple module to lookup the base format of HTTP response bodies from the `content-type` header. This module helps disambiguate the nature of the content, especially between `text/*` and `application/*`. The basic seven content type bases as defined [RFC1341](https://www.w3.org/Protocols/rfc1341/4_Content-Type.html) are:
- text
- multipart
- message
- image
- audio
- video
- application
However, from the content-type base, it is not easy to determine which formats are exactly "textual" in nature. For example, "text/json" as well as "application/json" are textual. This module disambiguates the same by maintaining a database of textual contents served over "application/*" content types.
## Usage
```terminal
npm install mime-format --save-dev;
```
```javascript
var mimeFormat = require('mime-format');
console.log(mimeFormat.lookup('application/xml; charset=gBk'));
// outputs
// {
// "type": "text",
// "format": "xml"
// "charset": "gBk"
// }
```
## How to handle unlisted (not in db) content types?
When the content type is not in internal db, it looks for keywords in content type for best match. Under those
circumstances, you will see a `guessed: true` property returned. In case even guess failed, you get `unknown: true` and
`format: 'raw'` will be sent.
If the contentType argument is not a string, then the detection is attempted by typecasting it to String.
## What is format?
Format is a secondary information for `type: 'text' and 'embed`. For texts, the format highlights what syntax the text
is in. Additionally, it doubles up to let you know text was not detected by returning value `raw`. For most cases this
is redundant.
## List of types:
- text
- image
- audio
- video
- embed
- message
- multipart
- unknown
## List of formats:
- audio
- video
- image
- plain
- jsonp
- json
- xml
- html
- yaml
- vml
- webml
- script
- raw

1770
node_modules/mime-format/db.json generated vendored Normal file

File diff suppressed because it is too large Load Diff

205
node_modules/mime-format/index.js generated vendored Normal file
View File

@@ -0,0 +1,205 @@
var /**
* @private
* @const
* @type {Object}
*/
db = require('./db.json'),
/**
* @private
* @const
* @type {String}
* @default
*/
SEP = '/',
/**
* @private
* @const
* @type {String}
* @default
*/
E = '',
/**
* @private
* @const
* @type {String}
* @default
*/
TEXT = 'text',
/**
* @private
* @const
* @type {String}
* @default
*/
RAW = 'raw',
/**
* @private
* @const
* @type {String}
* @default
*/
UNKNOWN = 'unknown',
/**
* @private
* @const
* @type {String}
* @default
*/
PLAIN = 'plain',
/**
* All the content type base types that mostly mean what they are meant to do!
*
* @private
* @const
* @type {RegExp}
* @default
*/
AUDIO_VIDEO_IMAGE_TEXT = /(audio|video|image|text)/,
/**
* A blanket check for commonly used keywords that are associated with text content type
*
* @private
* @const
* @type {RegExp}
* @default
*/
JSON_XML_SCRIPT_SIBLINGS = /(jsonp|json|xml|html|yaml|vml|webml|script)/,
/**
* Same check as the sure-shot bases, except that these must be sub-types
*
* @private
* @const
* @type {RegExp}
* @default
*/
AUDIO_VIDEO_IMAGE_TEXT_SUBTYPE = /\/[^\/]*(audio|video|image|text)/,
/**
* The content type bases that are not well defined or ambiguous to classify
*
* @private
* @const
* @type {RegExp}
* @default
*/
APPLICATION_MESSAGE_MULTIPART = /(application|message|multipart)/;
/**
* Simple module to lookup the base format of HTTP response bodies from the content-type header
* @module mime-format
*/
module.exports = {
/**
* Attempts to guess the format by analysing mime type and not a db lookup
* @private
* @param {String} mime - contentType header value
* @returns {Object}
*/
guess: function (mime) {
var info = {
type: UNKNOWN,
format: RAW,
guessed: true
},
match,
base;
// extract the mime base
base = (base = mime.split(SEP)) && base[0] || E;
// bail out on the mime types that are sure-shot ones with no ambiguity
match = base.match(AUDIO_VIDEO_IMAGE_TEXT);
if (match && match[1]) {
info.type = info.format = match[1];
// we do special kane matching to extract the format in case the match was text
// this ensures that we get same formats like we will do in kane match later down the line
if (info.type === TEXT) {
match = mime.match(JSON_XML_SCRIPT_SIBLINGS);
info.format = match && match[1] || PLAIN;
}
return info;
}
// we do a kane match on entire mime (not just base) to find texts
match = mime.match(JSON_XML_SCRIPT_SIBLINGS);
if (match && match[1]) {
info.type = TEXT;
info.format = match[1];
return info;
}
// now we match the subtype having names from the sure shot bases
match = mime.match(AUDIO_VIDEO_IMAGE_TEXT_SUBTYPE);
if (match && match[1]) {
info.type = info.format = match[1];
return info;
}
// now that most text and sure-shot types and sub-types are out of our way, we detect standard bases
// and rest are unknown
match = base.match(APPLICATION_MESSAGE_MULTIPART);
if (match && match[1]) {
info.type = match[1];
info.format = RAW;
return info;
}
// at this point nothing has matched nothing. it is worth keeping a note of it
info.orphan = true;
return info;
},
/**
* Finds the mime-format of the provided Content-Type
* @param {String} mime - Content-Type for which you want to find the mime format. e.g <b><i>application/xml</i></b>.
* @returns {Object}
* @example <caption>Basic usage</caption>
* mimeFormat.lookup('application/xml');
*
* // Output
* // {
* // "type": "text",
* // "format": "xml"
* // }
*
* @example <caption>Content-Type with charset</caption>
* mimeFormat.lookup('application/xml; charset=gBk');
*
* // Output
* // {
* // "type": "text",
* // "format": "xml",
* // "charset": "gBk"
* // }
*
* @example <caption>Unknown Content-Type</caption>
* mimeFormat.lookup('random/abc');
*
* // Output
* // {
* // "type": "unknown",
* // "format": "raw",
* // "guessed": true,
* // "orphan": true
* // }
*
*/
lookup: function mimeFormatLookup (mime) {
var charset = require('charset')(mime),
result;
// sanitise the mime argument
mime = String(mime).toLowerCase().replace(/\s/g, E).replace(/^([^;]+).*$/g, '$1');
result = db[mime];
result = result ? Object.assign({}, result) : module.exports.guess(mime);
// add the charset info to the mime.
result && charset && (result.charset = charset);
result && (result.source = mime); // store the sanitised mime
return result;
}
};

35
node_modules/mime-format/package.json generated vendored Normal file
View File

@@ -0,0 +1,35 @@
{
"name": "mime-format",
"version": "2.0.1",
"description": "Database to mime-format based on content-type header and content",
"main": "index.js",
"scripts": {
"test": "mocha unit-test.spec.js",
"build-docs": "./node_modules/.bin/jsdoc -c .jsdoc-config.json"
},
"repository": {
"type": "git",
"url": "git+https://github.com/postmanlabs/mime-format.git"
},
"keywords": [
"postman",
"http-code",
"mime",
"content-type"
],
"author": "Postman Labs <help@getpostman.com> (=)",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/postmanlabs/mime-format/issues"
},
"homepage": "https://github.com/postmanlabs/mime-format#readme",
"devDependencies": {
"expect.js": "^0.3.1",
"jsdoc": "^3.4.3",
"mocha": "^8.3.2",
"postman-jsdoc-theme": "^0.0.3"
},
"dependencies": {
"charset": "^1.0.0"
}
}

528
node_modules/mime-format/unit-test.spec.js generated vendored Normal file
View File

@@ -0,0 +1,528 @@
var expect = require('expect.js');
describe('lookup', function () {
var mimeFormat = require('./index.js');
describe('edge case', function () {
it('handles handle undefined mime with raw format', function () {
var mime = mimeFormat.lookup();
expect(mime).have.property('type', 'unknown');
expect(mime).have.property('format', 'raw');
expect(mime).have.property('guessed', true);
expect(mime).have.property('orphan', true);
expect(mime).not.have.property('charset');
});
it('handles handle blank mime with raw format', function () {
var mime = mimeFormat.lookup('');
expect(mime).have.property('type', 'unknown');
expect(mime).have.property('format', 'raw');
expect(mime).have.property('guessed', true);
expect(mime).have.property('orphan', true);
});
it('handles uppercase headers', function () {
var mime = mimeFormat.lookup('Application/Pdf');
expect(mime).have.property('type', 'embed');
expect(mime).have.property('format', 'pdf');
expect(mime).not.have.property('guessed');
});
it('handles normal charset', function () {
var mime = mimeFormat.lookup('application/unknown-stream; charset=utf8');
expect(mime).have.property('type', 'application');
expect(mime).have.property('format', 'raw');
expect(mime).have.property('guessed', true);
});
it('handles malformed charset', function () {
var mime = mimeFormat.lookup('application/pdf ; charset = text/utf8');
expect(mime).have.property('type', 'embed');
expect(mime).have.property('format', 'pdf');
expect(mime).not.have.property('guessed');
expect(mime).have.property('source', 'application/pdf');
expect(mime).have.property('charset', 'text');
});
it('handles untrimmed boundary whitespaces', function () {
var mime = mimeFormat.lookup(' application/pdf ; charset = text/utf8');
expect(mime).have.property('type', 'embed');
expect(mime).have.property('format', 'pdf');
expect(mime).not.have.property('guessed');
expect(mime).have.property('source', 'application/pdf');
expect(mime).have.property('charset', 'text');
});
it('handles untrimmed internal whitespaces outside db', function () {
var mime = mimeFormat.lookup('application / grooscript');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'script');
expect(mime).have.property('guessed', true);
expect(mime).have.property('source', 'application/grooscript');
});
it('removes unwanted spaces before referring db', function () {
var mime = mimeFormat.lookup('application / xml');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'xml');
expect(mime).not.have.property('guessed');
expect(mime).have.property('source', 'application/xml');
});
it('unknown bases return as "unknown"', function () {
var mime = mimeFormat.lookup('somebase/no-subtype');
expect(mime).have.property('type', 'unknown');
expect(mime).have.property('format', 'raw');
expect(mime).have.property('guessed');
expect(mime).have.property('orphan', true);
});
});
describe('sanity', function () {
it('"application/jwt" is treated as text with "jwt" format', function () {
var mime = mimeFormat.lookup('application/jwt');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'jwt');
expect(mime).not.have.property('guessed');
});
it('"application/x-www-form-urlencoded" is treated as text with "plain" format', function () {
var mime = mimeFormat.lookup('application/x-www-form-urlencoded');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'plain');
expect(mime).not.have.property('guessed');
});
it('"text/pdf" is treated as text even though it has "pdf" keyword', function () {
var mime = mimeFormat.lookup('text/pdf');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'plain');
expect(mime).have.property('guessed', true);
});
it('"text/plain" is basic and must work', function () {
var mime = mimeFormat.lookup('text/plain');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'plain');
expect(mime).have.property('guessed', true);
});
it('"text/xml" returns text with format as "xml"', function () {
var mime = mimeFormat.lookup('text/xml');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'xml');
expect(mime).have.property('guessed', true);
});
it('"text/hodor+mxml" has "mxml" ans as such matches xml format', function () {
var mime = mimeFormat.lookup('text/hodor+mxml');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'xml');
expect(mime).have.property('guessed', true);
});
it('"application/json" is "text" with json format', function () {
var mime = mimeFormat.lookup('application/json');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'json');
expect(mime).not.have.property('guessed');
});
it('"application/some+javascript" is text with "script" as format', function () {
var mime = mimeFormat.lookup('application/some+javascript');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'script');
expect(mime).have.property('guessed', true);
});
it('"application/some+vml" is treated as text with "vml" format', function () {
var mime = mimeFormat.lookup('application/some+vml');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'vml');
expect(mime).have.property('guessed', true);
});
it('"audio/some+vmll" is treated as audio even if it has "vml" keyword owing to the base', function () {
var mime = mimeFormat.lookup('audio/some+vml');
expect(mime).have.property('type', 'audio');
expect(mime).have.property('format', 'audio');
expect(mime).have.property('guessed', true);
});
it('"image/some+vmll" is treated as image even if it has "vml" keyword owing to the base', function () {
var mime = mimeFormat.lookup('image/some+vml');
expect(mime).have.property('type', 'image');
expect(mime).have.property('format', 'image');
expect(mime).have.property('guessed', true);
});
it('"application/pdf" is special and is treated as "embed" type with format as "pdf"', function () {
var mime = mimeFormat.lookup('application/pdf');
expect(mime).have.property('type', 'embed');
expect(mime).have.property('format', 'pdf');
expect(mime).not.have.property('guessed');
});
it('"application/xml" is simple text and returns format as xml', function () {
var mime = mimeFormat.lookup('application/xml');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'xml');
expect(mime).not.have.property('guessed');
});
});
describe("application autocompletes", function () {
it("application/atom+xml", function () {
var mime = mimeFormat.lookup('application/atom+xml');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'xml');
expect(mime).not.have.property('guessed');
});
it("application/ecmascript", function () {
var mime = mimeFormat.lookup('application/ecmascript');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'script');
expect(mime).not.have.property('guessed');
});
it("application/json", function () {
var mime = mimeFormat.lookup('application/json');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'json');
expect(mime).not.have.property('guessed');
});
it("application/javascript", function () {
var mime = mimeFormat.lookup('application/javascript');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'script');
expect(mime).not.have.property('guessed');
});
it("application/ogg", function () {
var mime = mimeFormat.lookup('application/ogg');
expect(mime).have.property('type', 'audio');
expect(mime).have.property('format', 'ogg');
expect(mime).not.have.property('guessed');
});
it("application/rdf+xml", function () {
var mime = mimeFormat.lookup('application/rdf+xml');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'xml');
expect(mime).not.have.property('guessed');
});
it("application/rss+xml", function () {
var mime = mimeFormat.lookup('application/rss+xml');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'xml');
expect(mime).not.have.property('guessed');
});
it("application/soap+xml", function () {
var mime = mimeFormat.lookup('application/soap+xml');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'xml');
expect(mime).not.have.property('guessed');
});
it("application/xhtml+xml", function () {
var mime = mimeFormat.lookup('application/xhtml+xml');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'xml');
expect(mime).not.have.property('guessed');
});
// need to add in db
it("application/octet-stream", function () {
var mime = mimeFormat.lookup('application/octet-stream');
expect(mime).have.property('type', 'application');
expect(mime).have.property('format', 'raw');
expect(mime).have.property('guessed');
});
it("application/pdf", function () {
var mime = mimeFormat.lookup('application/pdf');
expect(mime).have.property('type', 'embed');
expect(mime).have.property('format', 'pdf');
expect(mime).not.have.property('guessed');
});
it("application/postscript", function () {
var mime = mimeFormat.lookup('application/postscript');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'script');
expect(mime).have.property('guessed');
});
it("application/font-woff", function () {
var mime = mimeFormat.lookup('application/font-woff');
expect(mime).have.property('type', 'application');
expect(mime).have.property('format', 'raw');
expect(mime).have.property('guessed');
});
it("application/x-yaml", function () {
var mime = mimeFormat.lookup('application/x-yaml');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'yaml');
expect(mime).have.property('guessed');
});
it("application/xml", function () {
var mime = mimeFormat.lookup('application/xml');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'xml');
expect(mime).not.have.property('guessed');
});
it("application/xml-dtd", function () {
var mime = mimeFormat.lookup('application/xml-dtd');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'xml');
expect(mime).not.have.property('guessed');
});
it("application/xop+xml", function () {
var mime = mimeFormat.lookup('application/xop+xml');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'xml');
expect(mime).not.have.property('guessed');
});
it("application/zip", function () {
var mime = mimeFormat.lookup('application/zip');
expect(mime).have.property('type', 'application');
expect(mime).have.property('format', 'raw');
expect(mime).have.property('guessed');
});
it("application/gzip", function () {
var mime = mimeFormat.lookup('application/gzip');
expect(mime).have.property('type', 'application');
expect(mime).have.property('format', 'raw');
expect(mime).have.property('guessed');
});
it("application/graphql", function () {
var mime = mimeFormat.lookup('application/graphql');
expect(mime).have.property('type', 'application');
expect(mime).have.property('format', 'raw');
expect(mime).have.property('guessed');
});
it("audio/basic", function () {
var mime = mimeFormat.lookup('audio/ogg');
expect(mime).have.property('type', 'audio');
expect(mime).have.property('format', 'audio');
expect(mime).have.property('guessed');
});
it("audio/L24", function () {
var mime = mimeFormat.lookup('audio/L24');
expect(mime).have.property('type', 'audio');
expect(mime).have.property('format', 'audio');
expect(mime).have.property('guessed');
});
it("audio/mp4", function () {
var mime = mimeFormat.lookup('audio/mp4');
expect(mime).have.property('type', 'audio');
expect(mime).have.property('format', 'audio');
expect(mime).have.property('guessed');
});
it("audio/mpeg", function () {
var mime = mimeFormat.lookup('audio/mpeg');
expect(mime).have.property('type', 'audio');
expect(mime).have.property('format', 'audio');
expect(mime).have.property('guessed');
});
it("audio/ogg", function () {
var mime = mimeFormat.lookup('audio/ogg');
expect(mime).have.property('type', 'audio');
expect(mime).have.property('format', 'audio');
expect(mime).have.property('guessed');
});
it("audio/vorbis", function () {
var mime = mimeFormat.lookup('audio/vorbis');
expect(mime).have.property('type', 'audio');
expect(mime).have.property('format', 'audio');
expect(mime).have.property('guessed');
});
it("audio/vnd.rn-realaudio", function () {
var mime = mimeFormat.lookup('audio/vnd.rn-realaudio');
expect(mime).have.property('type', 'audio');
expect(mime).have.property('format', 'audio');
expect(mime).have.property('guessed');
});
it("audio/vnd.wave", function () {
var mime = mimeFormat.lookup('audio/ogvnd.waveg');
expect(mime).have.property('type', 'audio');
expect(mime).have.property('format', 'audio');
expect(mime).have.property('guessed');
});
it("audio/webm", function () {
var mime = mimeFormat.lookup('audio/webm');
expect(mime).have.property('type', 'audio');
expect(mime).have.property('format', 'audio');
expect(mime).have.property('guessed');
});
it("image/gif", function () {
var mime = mimeFormat.lookup('image/gif');
expect(mime).have.property('type', 'image');
expect(mime).have.property('format', 'image');
expect(mime).have.property('guessed');
});
it("image/jpeg", function () {
var mime = mimeFormat.lookup('image/jpeg');
expect(mime).have.property('type', 'image');
expect(mime).have.property('format', 'image');
expect(mime).have.property('guessed');
});
it("image/pjpeg", function () {
var mime = mimeFormat.lookup('image/pjpeg');
expect(mime).have.property('type', 'image');
expect(mime).have.property('format', 'image');
expect(mime).have.property('guessed');
});
it("image/png", function () {
var mime = mimeFormat.lookup('image/png');
expect(mime).have.property('type', 'image');
expect(mime).have.property('format', 'image');
expect(mime).have.property('guessed');
});
it("image/svg+xml", function () {
var mime = mimeFormat.lookup('image/svg+xml');
expect(mime).have.property('type', 'image');
expect(mime).have.property('format', 'image');
expect(mime).have.property('guessed');
});
it("image/tiff", function () {
var mime = mimeFormat.lookup('image/tiff');
expect(mime).have.property('type', 'image');
expect(mime).have.property('format', 'image');
expect(mime).have.property('guessed');
});
it("message/http", function () {
var mime = mimeFormat.lookup('message/http');
expect(mime).have.property('type', 'message');
expect(mime).have.property('format', 'raw');
expect(mime).have.property('guessed');
});
it("message/imdn+xml", function () {
var mime = mimeFormat.lookup('message/imdn+xml');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'xml');
expect(mime).not.have.property('guessed');
});
it("message/partial", function () {
var mime = mimeFormat.lookup('message/partial');
expect(mime).have.property('type', 'message');
expect(mime).have.property('format', 'raw');
expect(mime).have.property('guessed');
});
it("message/rfc822", function () {
var mime = mimeFormat.lookup('message/rfc822');
expect(mime).have.property('type', 'message');
expect(mime).have.property('format', 'raw');
expect(mime).have.property('guessed');
});
it("multipart/mixed", function () {
var mime = mimeFormat.lookup('multipart/mixed');
expect(mime).have.property('type', 'multipart');
expect(mime).have.property('format', 'raw');
expect(mime).have.property('guessed');
});
it("multipart/alternative", function () {
var mime = mimeFormat.lookup('multipart/alternative');
expect(mime).have.property('type', 'multipart');
expect(mime).have.property('format', 'raw');
expect(mime).have.property('guessed');
});
it("multipart/related", function () {
var mime = mimeFormat.lookup('multipart/related');
expect(mime).have.property('type', 'multipart');
expect(mime).have.property('format', 'raw');
expect(mime).have.property('guessed');
});
it("multipart/form-data", function () {
var mime = mimeFormat.lookup('multipart/form-data');
expect(mime).have.property('type', 'multipart');
expect(mime).have.property('format', 'raw');
expect(mime).have.property('guessed');
});
it("multipart/signed", function () {
var mime = mimeFormat.lookup('multipart/signed');
expect(mime).have.property('type', 'multipart');
expect(mime).have.property('format', 'raw');
expect(mime).have.property('guessed');
});
it("multipart/encrypted", function () {
var mime = mimeFormat.lookup('multipart/encrypted');
expect(mime).have.property('type', 'multipart');
expect(mime).have.property('format', 'raw');
expect(mime).have.property('guessed');
});
it("text/cmd", function () {
var mime = mimeFormat.lookup('text/cmd');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'plain');
expect(mime).have.property('guessed');
});
it("text/css", function () {
var mime = mimeFormat.lookup('text/css');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'plain');
expect(mime).have.property('guessed');
});
it("text/csv", function () {
var mime = mimeFormat.lookup('text/csv');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'plain');
expect(mime).have.property('guessed');
});
it("text/html", function () {
var mime = mimeFormat.lookup('text/html');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'html');
expect(mime).have.property('guessed');
});
it("text/plain", function () {
var mime = mimeFormat.lookup('text/plain');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'plain');
expect(mime).have.property('guessed');
});
it("text/vcard", function () {
var mime = mimeFormat.lookup('text/vcard');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'plain');
expect(mime).have.property('guessed');
});
it("text/xml", function () {
var mime = mimeFormat.lookup('text/xml');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'xml');
expect(mime).have.property('guessed');
});
});
describe("Charset from headers", function () {
it("text/html; charset=Shift_JIS", function() {
var mime = mimeFormat.lookup('text/html; charset=Shift_JIS');
expect(mime).have.property('charset', 'shift_jis');
});
it("text/html; charset=ISO-8859-1", function() {
var mime = mimeFormat.lookup('text/html; charset=ISO-8859-1');
expect(mime).have.property('charset', 'iso-8859-1');
});
});
describe("Charset won't be available if it is not mentioned", function () {
it("text/html", function() {
var mime = mimeFormat.lookup('text/html;');
expect(mime).not.have.property('charset');
});
it("charset which is not word, number and -, say text/html; charset=中文编码", function() {
var mime = mimeFormat.lookup('text/html;charset=中文编码');
expect(mime).not.have.property('charset');
});
});
describe("Regression", function () {
// Refer: https://github.com/postmanlabs/postman-app-support/issues/8876
it("charset provided in a call should not persist in subsequent calls without charset", function () {
var mime = mimeFormat.lookup('application/json; charset=utf-16');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'json');
expect(mime).have.property('charset', 'utf-16');
mime = mimeFormat.lookup('application/json');
expect(mime).have.property('type', 'text');
expect(mime).have.property('format', 'json');
expect(mime).not.have.property('charset');
});
})
});