dave
03/09/2018, 6:51 AMelifarley
03/09/2018, 6:55 AMdave
03/09/2018, 8:44 AMval hello = Header.required("foo").of<HttpMessage>("baa")
elifarley
03/09/2018, 10:51 AM("/api/v1/${this.path.format(param)}" bindContract GET).let { route: RouteBinder<HttpHandler> ->
handler.perform(route.newRequest().with(
Header.required("Service-Provider-Id") of "my-provider",
Header.required("Client-Realm-Id") of catalogName
), this.responseLens as BodyLens<T>
)
}
I'd like to have:
fun <T : HttpMessage> serviceProviderIDOf(x: String) = Header.required("Service-Provider-Id").of<T>(x)
val setServiceProviderId = Filter { next ->
{ next(it).with(serviceProviderIDOf("myval")) }
}
operator fun <T> invoke(handler: HttpHandler, catalogName: String, param: String): Pair<Status, T> =
("/api/v1/${this.path.format(param)}" bindContract GET).then(setServiceProviderId).let { route: RouteBinder<HttpHandler> ->
handler.perform(route.newRequest().with(
Header.required("Client-Realm-Id") of catalogName
), this.responseLens as BodyLens<T>
)
}
But it doesn't compile...dave
03/09/2018, 11:04 AMelifarley
03/09/2018, 11:04 AMdave
03/09/2018, 11:04 AMelifarley
03/09/2018, 11:50 AMelifarley
03/09/2018, 1:38 PMdave
03/09/2018, 1:42 PMelifarley
03/09/2018, 2:30 PM