forked from loafle/openapi-generator-original
[Typescript] Support text/html by ObjectSerializer.parse (#12459)
* add support text/html * regenerate samples * test
This commit is contained in:
@@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user