Skip to content

Commit

Permalink
updated http echo example
Browse files Browse the repository at this point in the history
  • Loading branch information
MainRo committed Jan 7, 2019
1 parent 2cb8256 commit 4401076
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions example/http_echo_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
def echo_server(source):
init = Observable.from_([
httpd.Initialize(),
httpd.AddRoute(method='POST', path='/echo', id='echo'),
httpd.AddRoute(methods=['GET'], path='/echo/{what}', id='echo'),
httpd.StartServer(host='localhost', port=8080),
])

echo = source.httpd.route \
.flat_map(lambda i: i.request) \
.map(lambda i: httpd.Response(
context=i.context,
data=i.data))
data=i.match_info['what'].encode('utf-8')))

control = Observable.merge(init, echo)
return EchoSink(httpd=httpd.Sink(control=control))
Expand Down

0 comments on commit 4401076

Please sign in to comment.