@microsoft.azure/autorest.testserver
Version:
Autorest test server.
54 lines • 2.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const api_1 = require("../api");
api_1.app.category("vanilla", () => {
// Returns an error response with secrets and PII in the headers and body.
api_1.app.get("/secrets/error", "ErrorWithSecrets", (req) => {
return {
status: 403,
testSuccessful: true,
headers: {
// Following headers should be redacted.
"x-ms-pii": "true",
// Following headers should not be redacted.
"x-ms-request-id": "5e123516-834e-4222-9e80-353108d33357",
"x-ms-version": "2022-02-01",
},
body: (0, api_1.json)({
error: {
code: "Unauthorized",
message: "The user 'user@contoso.com' is unauthorized.",
details: [
{
code: "UnauthorizedSharedKey",
innererror: "Shared key 1c88a67921784300a462b2cb61da2339 is not permitted access.",
},
],
token: "1c88a67921784300a462b2cb61da2339",
},
primaryKey: "1c88a67921784300a462b2cb61da2339",
connectionString: "Key1=1c88a67921784300a462b2cb61da2339",
}),
};
});
api_1.app.post("/secrets/[:]create", "RequestWithSecrets", (req) => {
req.expect.containsHeader("authorization", "SharedKey 1c88a67921784300a462b2cb61da2339");
req.expect.containsQueryParam("key", "1c88a67921784300a462b2cb61da2339");
req.expect.bodyEquals({ key: "1c88a67921784300a462b2cb61da2339" });
return {
status: 200,
headers: {
// Following headers should be redacted.
"x-ms-pii": "true",
// Following headers should not be redacted.
"x-ms-request-id": "49997f20-3cee-4c0c-92ff-572acbbed13d",
"x-ms-version": "2022-02-01",
},
body: (0, api_1.json)({
key: "1c88a67921784300a462b2cb61da2339",
value: "secret",
}),
};
});
});
//# sourceMappingURL=error-with-secrets.js.map