[Typescript] Support text/html by ObjectSerializer.parse (#12459)

* add support text/html

* regenerate samples

* test
This commit is contained in:
Kuzma
2022-05-30 12:51:37 +03:00
committed by GitHub
parent 51f624ebe4
commit 6f322060f7
10 changed files with 42 additions and 0 deletions

View File

@@ -244,6 +244,10 @@ export class ObjectSerializer {
return JSON.parse(rawData);
}
if (mediaType === "text/html") {
return rawData;
}
throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.parse.");
}
}

View File

@@ -216,6 +216,10 @@ export class ObjectSerializer {
return JSON.parse(rawData);
}
if (mediaType === "text/html") {
return rawData;
}
throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.parse.");
}
}

View File

@@ -233,6 +233,10 @@ export class ObjectSerializer {
return JSON.parse(rawData);
}
if (mediaType === "text/html") {
return rawData;
}
throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.parse.");
}
}

View File

@@ -245,6 +245,10 @@ export class ObjectSerializer {
return JSON.parse(rawData);
}
if (mediaType === "text/html") {
return rawData;
}
throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.parse.");
}
}

View File

@@ -233,6 +233,10 @@ export class ObjectSerializer {
return JSON.parse(rawData);
}
if (mediaType === "text/html") {
return rawData;
}
throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.parse.");
}
}

View File

@@ -233,6 +233,10 @@ export class ObjectSerializer {
return JSON.parse(rawData);
}
if (mediaType === "text/html") {
return rawData;
}
throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.parse.");
}
}

View File

@@ -233,6 +233,10 @@ export class ObjectSerializer {
return JSON.parse(rawData);
}
if (mediaType === "text/html") {
return rawData;
}
throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.parse.");
}
}

View File

@@ -233,6 +233,10 @@ export class ObjectSerializer {
return JSON.parse(rawData);
}
if (mediaType === "text/html") {
return rawData;
}
throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.parse.");
}
}

View File

@@ -233,6 +233,10 @@ export class ObjectSerializer {
return JSON.parse(rawData);
}
if (mediaType === "text/html") {
return rawData;
}
throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.parse.");
}
}

View File

@@ -231,4 +231,10 @@ describe("ObjectSerializer", () => {
expect(deserialized).to.deep.equal(categories)
})
})
describe("Parse", () => {
it("text/html", () => {
const input = "<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"/>\n<title>Error 404 Not Found</title>\n</head>\n<body><h2>HTTP ERROR 404</h2>\n<p>Resource not found</p>\n</body>\n</html>\n"
expect(ObjectSerializer.parse(input, "text/html")).to.equal(input)
});
})
})