Fixed wrong assertion related to upload_data and upload_filename in HTTP_CLIENT_REQUEST_CONTEXT .
Fixed issue #124 Enable all assertion for the related autotest cases.
This commit is contained in:
@@ -86,16 +86,20 @@ feature -- Access
|
|||||||
feature -- Status report
|
feature -- Status report
|
||||||
|
|
||||||
has_form_data: BOOLEAN
|
has_form_data: BOOLEAN
|
||||||
|
-- Has any form parameters?
|
||||||
|
--| i.e coming from POST or PUT content.
|
||||||
do
|
do
|
||||||
Result := not form_parameters.is_empty
|
Result := not form_parameters.is_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
has_upload_data: BOOLEAN
|
has_upload_data: BOOLEAN
|
||||||
|
-- Has associated upload_data?
|
||||||
do
|
do
|
||||||
Result := attached upload_data as d and then not d.is_empty
|
Result := attached upload_data as d and then not d.is_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
has_upload_filename: BOOLEAN
|
has_upload_filename: BOOLEAN
|
||||||
|
-- Has associated upload_filename?
|
||||||
do
|
do
|
||||||
Result := attached upload_filename as fn and then not fn.is_empty
|
Result := attached upload_filename as fn and then not fn.is_empty
|
||||||
end
|
end
|
||||||
@@ -109,11 +113,13 @@ feature -- Status report
|
|||||||
feature -- Element change
|
feature -- Element change
|
||||||
|
|
||||||
add_header (k: READABLE_STRING_8; v: READABLE_STRING_8)
|
add_header (k: READABLE_STRING_8; v: READABLE_STRING_8)
|
||||||
|
-- Add http header line `k:v'.
|
||||||
do
|
do
|
||||||
headers.force (v, k)
|
headers.force (v, k)
|
||||||
end
|
end
|
||||||
|
|
||||||
add_header_line (s: READABLE_STRING_8)
|
add_header_line (s: READABLE_STRING_8)
|
||||||
|
-- Add http header line `s'.
|
||||||
local
|
local
|
||||||
i: INTEGER
|
i: INTEGER
|
||||||
do
|
do
|
||||||
@@ -124,6 +130,7 @@ feature -- Element change
|
|||||||
end
|
end
|
||||||
|
|
||||||
add_header_lines (lst: ITERABLE [READABLE_STRING_8])
|
add_header_lines (lst: ITERABLE [READABLE_STRING_8])
|
||||||
|
-- Add collection of http header lines `lst'
|
||||||
do
|
do
|
||||||
across
|
across
|
||||||
lst as c
|
lst as c
|
||||||
@@ -133,44 +140,61 @@ feature -- Element change
|
|||||||
end
|
end
|
||||||
|
|
||||||
add_query_parameter (k: READABLE_STRING_32; v: READABLE_STRING_32)
|
add_query_parameter (k: READABLE_STRING_32; v: READABLE_STRING_32)
|
||||||
|
-- Add a query parameter `k=v'.
|
||||||
do
|
do
|
||||||
query_parameters.force (v, k)
|
query_parameters.force (v, k)
|
||||||
end
|
end
|
||||||
|
|
||||||
add_form_parameter (k: READABLE_STRING_32; v: READABLE_STRING_32)
|
add_form_parameter (k: READABLE_STRING_32; v: READABLE_STRING_32)
|
||||||
|
-- Add a form parameter `k'= `v'.
|
||||||
do
|
do
|
||||||
form_parameters.force (v, k)
|
form_parameters.force (v, k)
|
||||||
end
|
end
|
||||||
|
|
||||||
set_credentials_required (b: BOOLEAN)
|
set_credentials_required (b: BOOLEAN)
|
||||||
|
-- If b is True, credentials are required, otherwise just optional.
|
||||||
do
|
do
|
||||||
credentials_required := b
|
credentials_required := b
|
||||||
end
|
end
|
||||||
|
|
||||||
set_upload_data (a_data: like upload_data)
|
set_upload_data (a_data: like upload_data)
|
||||||
|
-- Set `upload_data' to `a_data'
|
||||||
|
--| note: the Current context can have upload_data XOR upload_filename, but not both.
|
||||||
require
|
require
|
||||||
has_no_upload_data: a_data /= Void implies not has_upload_data
|
has_upload_filename: (a_data /= Void and then not a_data.is_empty) implies not has_upload_filename
|
||||||
do
|
do
|
||||||
upload_data := a_data
|
if a_data = Void or else a_data.is_empty then
|
||||||
|
upload_data := Void
|
||||||
|
else
|
||||||
|
upload_data := a_data
|
||||||
|
end
|
||||||
|
ensure
|
||||||
|
(a_data /= Void and then not a_data.is_empty) implies (has_upload_data and not has_upload_filename)
|
||||||
end
|
end
|
||||||
|
|
||||||
set_upload_filename (a_fn: detachable READABLE_STRING_GENERAL)
|
set_upload_filename (a_fn: detachable READABLE_STRING_GENERAL)
|
||||||
|
-- Set `upload_filename' to `a_fn'
|
||||||
|
--| note: the Current context can have upload_data XOR upload_filename, but not both.
|
||||||
require
|
require
|
||||||
has_no_upload_filename: a_fn /= Void implies not has_upload_filename
|
has_no_upload_data: (a_fn /= Void and then not a_fn.is_empty) implies not has_upload_data
|
||||||
do
|
do
|
||||||
if a_fn = Void then
|
if a_fn = Void or else a_fn.is_empty then
|
||||||
upload_filename := Void
|
upload_filename := Void
|
||||||
else
|
else
|
||||||
create upload_filename.make_from_string_general (a_fn)
|
create upload_filename.make_from_string_general (a_fn)
|
||||||
end
|
end
|
||||||
|
ensure
|
||||||
|
(a_fn /= Void and then not a_fn.is_empty) implies (has_upload_filename and not has_upload_data)
|
||||||
end
|
end
|
||||||
|
|
||||||
set_write_agent (agt: like write_agent)
|
set_write_agent (agt: like write_agent)
|
||||||
|
-- Set `write_agent' to `agt'.
|
||||||
do
|
do
|
||||||
write_agent := agt
|
write_agent := agt
|
||||||
end
|
end
|
||||||
|
|
||||||
set_output_file (f: FILE)
|
set_output_file (f: FILE)
|
||||||
|
-- Set `output_file' to `f'.
|
||||||
require
|
require
|
||||||
f_is_open_write: f.is_open_write
|
f_is_open_write: f.is_open_write
|
||||||
do
|
do
|
||||||
@@ -178,6 +202,7 @@ feature -- Element change
|
|||||||
end
|
end
|
||||||
|
|
||||||
set_output_content_file (f: FILE)
|
set_output_content_file (f: FILE)
|
||||||
|
-- Set `output_content_file' to `f'.
|
||||||
require
|
require
|
||||||
f_is_open_write: f.is_open_write
|
f_is_open_write: f.is_open_write
|
||||||
do
|
do
|
||||||
@@ -187,6 +212,8 @@ feature -- Element change
|
|||||||
feature -- Status setting
|
feature -- Status setting
|
||||||
|
|
||||||
set_proxy (a_host: detachable READABLE_STRING_8; a_port: INTEGER)
|
set_proxy (a_host: detachable READABLE_STRING_8; a_port: INTEGER)
|
||||||
|
-- Set proxy to `a_host:a_port'.
|
||||||
|
--| this can be used for instance with "http://fiddler2.com/" web debugging proxy.
|
||||||
do
|
do
|
||||||
if a_host = Void then
|
if a_host = Void then
|
||||||
proxy := Void
|
proxy := Void
|
||||||
@@ -212,6 +239,7 @@ feature -- Conversion helpers
|
|||||||
feature {NONE} -- Implementation
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
parameters_to_url_encoded_string (ht: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_32]): STRING_8
|
parameters_to_url_encoded_string (ht: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_32]): STRING_8
|
||||||
|
-- Build url encoded string using parameters from `ht'.
|
||||||
do
|
do
|
||||||
create Result.make (64)
|
create Result.make (64)
|
||||||
from
|
from
|
||||||
@@ -230,6 +258,7 @@ feature {NONE} -- Implementation
|
|||||||
end
|
end
|
||||||
|
|
||||||
url_encoder: URL_ENCODER
|
url_encoder: URL_ENCODER
|
||||||
|
-- Shared URL encoder.
|
||||||
once
|
once
|
||||||
create Result
|
create Result
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,10 +8,14 @@
|
|||||||
<exclude>/.svn$</exclude>
|
<exclude>/.svn$</exclude>
|
||||||
</file_rule>
|
</file_rule>
|
||||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all">
|
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all">
|
||||||
<assertions precondition="true"/>
|
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||||
</option>
|
</option>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
<library name="http_client" location="..\http_client-safe.ecf" readonly="false"/>
|
<library name="http_client" location="..\http_client-safe.ecf" readonly="false" use_application_options="true">
|
||||||
|
<option>
|
||||||
|
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||||
|
</option>
|
||||||
|
</library>
|
||||||
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
|
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
|
||||||
<tests name="tests" location=".\"/>
|
<tests name="tests" location=".\"/>
|
||||||
</target>
|
</target>
|
||||||
|
|||||||
Reference in New Issue
Block a user