Update the restbuck_client, still work in progress.
Update restbuck_server, remove unused class in inherit. Update libcurl_http_client_request, to parse context headers before the execution. Update wgi_input_stream, commented precondition.
This commit is contained in:
@@ -17,12 +17,26 @@ feature {NONE} -- Initialization
|
||||
local
|
||||
h: LIBCURL_HTTP_CLIENT
|
||||
sess: HTTP_CLIENT_SESSION
|
||||
do
|
||||
create h.make
|
||||
sess := h.new_session ("http://127.0.0.1:8080")
|
||||
-- Create Order
|
||||
create_order (sess)
|
||||
|
||||
-- if id /= Void and then attached sess.get ("/order/" + id, Void) as r then
|
||||
-- print (r.body)
|
||||
-- io.put_new_line
|
||||
-- end
|
||||
end
|
||||
|
||||
|
||||
create_order (sess: HTTP_CLIENT_SESSION)
|
||||
local
|
||||
s: READABLE_STRING_8
|
||||
j: JSON_PARSER
|
||||
id: detachable STRING
|
||||
context : HTTP_CLIENT_REQUEST_CONTEXT
|
||||
do
|
||||
create h.make
|
||||
sess := h.new_session ("http://127.0.0.1")
|
||||
s := "[
|
||||
{
|
||||
"location":"takeAway",
|
||||
@@ -37,32 +51,25 @@ feature {NONE} -- Initialization
|
||||
}
|
||||
]"
|
||||
|
||||
if attached sess.post ("/order", Void, s) as r then
|
||||
create context.make
|
||||
context.headers.put ("application/json", "Content-Type")
|
||||
if attached sess.post ("/order", context, s) as r then
|
||||
print (r.raw_header)
|
||||
io.put_new_line
|
||||
if attached r.body as m then
|
||||
create j.make_parser (m)
|
||||
|
||||
if j.is_parsed and attached j.parse_object as j_o then
|
||||
if attached {JSON_STRING} j_o.item ("id") as l_id then
|
||||
id := l_id.item
|
||||
end
|
||||
print (m)
|
||||
io.put_new_line
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if id /= Void and then attached sess.get ("/order/" + id, Void) as r then
|
||||
print (r.body)
|
||||
io.put_new_line
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Status
|
||||
|
||||
feature -- Access
|
||||
|
||||
feature -- Change
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@ inherit
|
||||
|
||||
URI_TEMPLATE_ROUTED_SERVICE
|
||||
|
||||
ROUTED_SERVICE_HELPER
|
||||
|
||||
DEFAULT_SERVICE
|
||||
|
||||
create
|
||||
|
||||
Reference in New Issue
Block a user