Fix GraphQL private header routing priority mismatch#1308
Conversation
|
in short, this's a correctness for a corner case in the private mode: in getting svckey, the priority was: X-Api-Name > X-Schemata > X-Meta-Schema and in getting the value(its mode), the priority was: X-Schemata > X-Api-Name > X-Meta-Schema so there'll be a possible missmatch when there're both 'X-Api-Name' and 'X-Schemata': The PR is a small correctness fix with a minor refactor: it centralizes the private header priority so key generation and mode selection cannot diverge again. |
Summary
Align private GraphQL API routing priority between
getSvcKey()anddetermineMode().Previously, requests containing both
X-Api-NameandX-Schematacould be cached under anapi:<db>:<apiName>service key while being resolved through theschemata-headerpath. That could store an admin-style schema-header API structure under a named API cache key.This PR makes both paths use the same private header priority:
X-Api-Name > X-Schemata > X-Meta-SchemaChanges
X-Api-Nameservice-key semantics unchanged.X-Api-Name/X-Schematarequests.Validation
pnpm --filter @constructive-io/graphql-server exec jest src/middleware/__tests__/api.test.ts --runInBandpnpm --filter @constructive-io/graphql-server buildpnpm --filter @constructive-io/graphql-server exec jest --runInBand