Basic initial Eiffel NET implementation.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-10-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-10-0 http://www.eiffel.com/developers/xml/configuration-1-10-0.xsd" name="test_http_client" uuid="920E5C50-41E1-4DAC-8D48-D9C860E49228">
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-14-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-14-0 http://www.eiffel.com/developers/xml/configuration-1-14-0.xsd" name="test_http_client" uuid="920E5C50-41E1-4DAC-8D48-D9C860E49228">
|
||||
<target name="test_http_client">
|
||||
<root class="TEST" feature="make"/>
|
||||
<file_rule>
|
||||
|
||||
@@ -15,7 +15,7 @@ inherit
|
||||
|
||||
feature -- Test routines
|
||||
|
||||
test_http_client
|
||||
test_libcurl_http_client
|
||||
-- New test routine
|
||||
local
|
||||
sess: LIBCURL_HTTP_CLIENT_SESSION
|
||||
@@ -42,6 +42,53 @@ feature -- Test routines
|
||||
assert ("Not found", False)
|
||||
end
|
||||
end
|
||||
|
||||
test_socket_http_client
|
||||
-- New test routine
|
||||
local
|
||||
sess: NET_HTTP_CLIENT_SESSION
|
||||
h: STRING_8
|
||||
do
|
||||
create sess.make ("http://www.google.com")
|
||||
if attached sess.get ("/search?q=eiffel", Void) as res then
|
||||
assert ("Get returned without error", not res.error_occurred)
|
||||
create h.make_empty
|
||||
if attached res.headers as hds then
|
||||
across
|
||||
hds as c
|
||||
loop
|
||||
h.append (c.item.name + ": " + c.item.value + "%R%N")
|
||||
end
|
||||
end
|
||||
if attached res.body as l_body then
|
||||
assert ("body not empty", not l_body.is_empty)
|
||||
else
|
||||
assert ("missing body", False)
|
||||
end
|
||||
assert ("same headers", h.same_string (res.raw_header))
|
||||
else
|
||||
assert ("Not found", False)
|
||||
end
|
||||
end
|
||||
|
||||
test_socket_http_client_requestbin
|
||||
local
|
||||
sess: NET_HTTP_CLIENT_SESSION
|
||||
h: STRING_8
|
||||
do
|
||||
--| Add your code here
|
||||
create sess.make("http://requestb.in")
|
||||
create h.make_empty
|
||||
if attached sess.get ("/1a0q2h61", Void).headers as hds then
|
||||
across
|
||||
hds as c
|
||||
loop
|
||||
h.append (c.item.name + ": " + c.item.value + "%R%N")
|
||||
end
|
||||
end
|
||||
|
||||
print (h)
|
||||
end
|
||||
|
||||
test_headers
|
||||
local
|
||||
|
||||
Reference in New Issue
Block a user