Skip to content

Instantly share code, notes, and snippets.

@kadyana
Created April 5, 2015 18:20
Show Gist options
  • Save kadyana/68a54ad1d64173d82caf to your computer and use it in GitHub Desktop.
Save kadyana/68a54ad1d64173d82caf to your computer and use it in GitHub Desktop.
def content = client.get('/test123') { req ->
//prepare content-type
req.header('Content-Type', 'text/plain')
//return a producing stream to send some data along the request
Streams
.just("Hello")
.log('client-send')
}.flatMap { replies ->
//successful request, listen for replies
replies
.log('client-received')
.when(RuntimeException.class) { ex ->
System.out.println(ex)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment