diff --git a/src/core/config/Categories.json b/src/core/config/Categories.json index bebdd6a5e2..f628a83f8b 100644 --- a/src/core/config/Categories.json +++ b/src/core/config/Categories.json @@ -238,6 +238,7 @@ "Parse UDP", "Parse SSH Host Key", "Parse URI", + "Extract URI", "URL Encode", "URL Decode", "Protobuf Decode", diff --git a/tests/operations/index.mjs b/tests/operations/index.mjs index 40ce7a2ee6..cc3cca82d3 100644 --- a/tests/operations/index.mjs +++ b/tests/operations/index.mjs @@ -64,6 +64,7 @@ import "./tests/ELFInfo.mjs"; import "./tests/Enigma.mjs"; import "./tests/ExtractEmailAddresses.mjs"; import "./tests/ExtractHashes.mjs"; +import "./tests/ExtractURI.mjs"; import "./tests/Float.mjs"; import "./tests/FileTree.mjs"; import "./tests/FletcherChecksum.mjs"; diff --git a/tests/operations/tests/ExtractURI.mjs b/tests/operations/tests/ExtractURI.mjs new file mode 100644 index 0000000000..9e08d4f069 --- /dev/null +++ b/tests/operations/tests/ExtractURI.mjs @@ -0,0 +1,36 @@ +/** + * Extract URI Tests + * + * @author David Tomaschik [dwt@google.com] + * @copyright Google LLC 2024 + * @license Apache-2.0 + */ + +import TestRegister from "../../lib/TestRegister.mjs"; + +TestRegister.addTests([ + { + name: "Extract URI: Test", + input: "http://www.example.org:9999/path?foo=bar&baz=1&baz=2#frob", + expectedOutput: JSON.stringify({ + "protocol": "http:", + "hostname": "www.example.org", + "port": "9999", + "pathname": "/path", + "hash": "#frob", + "query": { + "foo": "bar", + "baz": [ + "1", + "2" + ] + } + }, null, 4), + recipeConfig: [ + { + "op": "Extract URI", + "args": [], + } + ] + } +]);