UNPKG

@microsoft.azure/autorest.testserver

Version:
97 lines 2.95 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const api_1 = require("../api"); api_1.app.category("vanilla", () => { api_1.app.post("/mediatypes/analyzeNoAccept", "MediaTypesAnalyzeBodyNoAcceptHeader", (req) => { const contentType = req.headers["content-type"]; const body = req.body; if (contentType === "application/json" && "source" in body) { return { status: 202, }; } else if (contentType === "application/pdf" && body === "PDF") { return { status: 202, }; } else { return { status: 400, }; } }); api_1.app.post("/mediatypes/binaryBodyTwoContentTypes", "MediaTypesTwoContentTypes", (req) => { const contentType = req.headers["content-type"]; if (contentType === "application/json") { req.expect.bodyEquals({ hello: "world" }); return { status: 200, }; } else if (contentType === "application/octet-stream") { req.expect.bodyNotEmpty(); return { status: 200, }; } else { return { status: 400, }; } }); api_1.app.post("/mediatypes/binaryBodyThreeContentTypes", "MediaTypesThreeContentTypes", (req) => { const contentType = req.headers["content-type"]; if (contentType === "application/json") { req.expect.bodyEquals({ hello: "world" }); return { status: 200, }; } else if (contentType === "application/octet-stream") { req.expect.bodyNotEmpty(); return { status: 200, }; } else if (contentType === "text/plain") { req.expect.bodyEquals("hello, world"); return { status: 200, }; } else { return { status: 400, }; } }); api_1.app.post("/mediatypes/bodyThreeTypes", "MediaTypesThreeBodyTypes", (req) => { const contentType = req.headers["content-type"]; if (contentType === "application/json") { req.expect.bodyEquals({ hello: "world" }); return { status: 200, }; } else if (contentType === "application/octet-stream") { req.expect.bodyNotEmpty(); return { status: 200, }; } else if (contentType === "text/plain") { req.expect.bodyEquals("hello, world"); return { status: 200, }; } else { return { status: 400, }; } }); }); //# sourceMappingURL=media-types.js.map