Http Headers and Date Math
- Date
Http Headers
The @HttpHeader
annotation now is now supported, for setting headers on HTTP requests.
For example:
service MyService {
@HttpOperation(method = "GET", url = "...")
// A fixed, static header
@HttpHeader(name = "Consumes", value = "application/json")
operation findPeople():Person[]
// A header that's calculated
operation findPeople(
@HttpHeader(name = "If-Modified-Since") ifModifiedSince : Instant = addDays(now(),-7)
):Person[]
}
You can also pass header values in using the given {}
clause in a query:
service MyService {
operation findPeople(
@HttpHeader(name = "Cache-Control", prefix = "max-age=") cacheMaxAge : CacheMaxAge
):Person[]
}
// which is then invoked as:
given { maxAge : CacheMaxAge = 64000 }
find { Person[] }
Read more about it in our docs
Date math
The stdlib in Taxi has been expanded to add date math functions to the stdlib:
addMinutes
addDays
addSeconds
now
parseDate
Read more about these in the Taxi docs