feat: segmented content-type dropdown UI (#2382)
Co-authored-by: liyasthomas <liyascthomas@gmail.com>
This commit is contained in:
@@ -14,6 +14,37 @@ export const knownContentTypes: Record<ValidContentTypes, Content> = {
|
||||
"text/plain": "plain",
|
||||
}
|
||||
|
||||
type ContentTypeTitle =
|
||||
| "request.content_type_titles.text"
|
||||
| "request.content_type_titles.structured"
|
||||
| "request.content_type_titles.others"
|
||||
|
||||
type SegmentedContentType = {
|
||||
title: ContentTypeTitle
|
||||
contentTypes: ValidContentTypes[]
|
||||
}
|
||||
|
||||
export const segmentedContentTypes: SegmentedContentType[] = [
|
||||
{
|
||||
title: "request.content_type_titles.text",
|
||||
contentTypes: [
|
||||
"application/json",
|
||||
"application/ld+json",
|
||||
"application/hal+json",
|
||||
"application/vnd.api+json",
|
||||
"application/xml",
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "request.content_type_titles.structured",
|
||||
contentTypes: ["application/x-www-form-urlencoded", "multipart/form-data"],
|
||||
},
|
||||
{
|
||||
title: "request.content_type_titles.others",
|
||||
contentTypes: ["text/html", "text/plain"],
|
||||
},
|
||||
]
|
||||
|
||||
export function isJSONContentType(contentType: string) {
|
||||
return /\bjson\b/i.test(contentType)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user