refactor: separate out data structures into hoppscotch-data

This commit is contained in:
Andrew Bastin
2021-11-24 01:20:07 +05:30
parent 2884854aab
commit 38755bf3e3
47 changed files with 820 additions and 74 deletions

View File

@@ -1,6 +1,6 @@
import { combineLatest, Observable } from "rxjs"
import { map } from "rxjs/operators"
import { FormDataKeyValue, HoppRESTRequest } from "../types/HoppRESTRequest"
import { FormDataKeyValue, HoppRESTRequest } from "@hoppscotch/data"
import { parseTemplateString, parseBodyEnvVariables } from "../templating"
import { Environment, getGlobalVariables } from "~/newstore/environments"

View File

@@ -1,4 +1,8 @@
export const knownContentTypes = {
import { ValidContentTypes } from "@hoppscotch/data"
export type Content = "json" | "xml" | "multipart" | "html" | "plain"
export const knownContentTypes: Record<ValidContentTypes, Content> = {
"application/json": "json",
"application/ld+json": "json",
"application/hal+json": "json",
@@ -10,8 +14,6 @@ export const knownContentTypes = {
"text/plain": "plain",
}
export type ValidContentTypes = keyof typeof knownContentTypes
export function isJSONContentType(contentType: string) {
return /\bjson\b/i.test(contentType)
}