Implement optional defaultKey for all cases of self-sharding by key
The optional spec.shard.defaultKey
field was added in 173ee4f4 for use with self-sharding by cookie. If this field is present, and the specified cookie is missing in a request, then the default key value is used instead. If defaultKey
is not present and the cookie is missing, generate a synthetic 400 response.
Currently this is only implemented for self-sharding by cookie. Extend defaultKey
for use as a fallback for other uses of by=KEY
, for example when a request header is specified, since the header may be missing from the request.