Skip to content

Commit 896d57a

Browse files
committed
fix: regex
1 parent f8653cc commit 896d57a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

packages/bruno-converters/src/openapi/openapi-to-bruno.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ import { validateSchema, transformItemsInCollection, hydrateSeqInCollection, uui
55

66
// Content type patterns for matching MIME type variants
77
// These patterns handle structured types with many variants (e.g., application/ld+json, application/vnd.api+json)
8+
// MIME types can contain: letters, numbers, hyphens, dots, and plus signs
89
const CONTENT_TYPE_PATTERNS = {
910
// Matches: application/json, application/ld+json, application/vnd.api+json, text/json, etc.
10-
JSON: /^[\w\-]+\/([\w\-]+\+)?json$/,
11-
// Matches: application/xml, text/xml, application/atom+xml, application/rss+xml, etc.
12-
XML: /^[\w\-]+\/([\w\-]+\+)?xml$/,
13-
// Matches: text/html, application/xhtml+xml
14-
HTML: /^[\w\-]+\/([\w\-]+\+)?html$/
11+
// Pattern: type/([base]+)?suffix where suffix is json
12+
JSON: /^[\w\-.+]+\/([\w\-.+]+\+)?json$/,
13+
// Matches: application/xml, text/xml, application/atom+xml, application/rss+xml, application/xhtml+xml, etc.
14+
// Pattern: type/([base]+)?suffix where suffix is xml
15+
XML: /^[\w\-.+]+\/([\w\-.+]+\+)?xml$/,
16+
// Matches: text/html
17+
// Pattern: type/([base]+)?suffix where suffix is html
18+
HTML: /^[\w\-.+]+\/([\w\-.+]+\+)?html$/
1519
};
1620

1721
const ensureUrl = (url) => {

0 commit comments

Comments
 (0)