Question
In descriptions of endpoint parameters, such as CDS Banking APIs, the x-v
and x-min-v
request header Type
property is string
. In CDS HTTP Headers, the x-v
and x-min-v
request header Description
property states that they "must be set to a positive integer". Which is correct?
The second question is about response header parameter x-v
. If the required API version is 1
, and the request header contains x-v=0001
, what are the status of the request and the required response:
- Request is valid and response header is
x-v=1
- Request is invalid and response is
400 Bad Request
- Request is valid and response header is
x-v=0001
Answer
The requirement is to populate the x-v
and x-min-v
headers with positive integer values. Technically, all headers are strings. Unlike in the JSON specification, the HTTP specification does not make a distinction for headers between numbers and strings.
If the request header contains x-v=0001
, the best response is to treat the request as valid and returnx-v=1
. A good, tolerant server implementation allows any technically correct request. The standards do not require leading zeroes for a positive integer but do not preclude leading zeroes. Treating this as an error would be an over-interpretation and not aligned with the intent. If you are building an ADR solution, however, the DSB does not recommend using leading zeroes in the x-v
and x-min-v
values.
Comments
0 comments
Please sign in to leave a comment.