Require HTTPS-only external pricing-provider URLs and verify the adapter contract with the application suite.
This commit is contained in:
@@ -58,6 +58,26 @@ test("fixture provider returns deterministic normalized observations", async ()
|
||||
});
|
||||
});
|
||||
|
||||
test("http provider rejects insecure or malformed external provider URLs", () => {
|
||||
assert.throws(
|
||||
() =>
|
||||
createHttpPricingProvider({
|
||||
id: "http-provider",
|
||||
endpoint: "http://provider.example/prices",
|
||||
}),
|
||||
/HTTPS/i,
|
||||
);
|
||||
|
||||
assert.throws(
|
||||
() =>
|
||||
createHttpPricingProvider({
|
||||
id: "http-provider",
|
||||
endpoint: "not-a-url",
|
||||
}),
|
||||
/valid https URL/i,
|
||||
);
|
||||
});
|
||||
|
||||
test("http provider sends mapping context and normalizes its response", async () => {
|
||||
let request;
|
||||
const provider = createHttpPricingProvider({
|
||||
|
||||
Reference in New Issue
Block a user