I've created a contract on a provider side:
Contract.make {
request {
method 'GET'
url('/cars/car?id=3')
headers {
header(accept(), "application/hal+json")
header(SOME OTHER HEADER)
}
}
response {
...
}
}
Unfortunately one of my customers do not send request with "header(SOME OTHER HEADER)". My question is how can I mark "header(SOME OTHER HEADER)" as optional?
You can have the value optional. Not the header itself. If the header is optional then create two separate contracts. One with the header and one without it.