diff --git a/examples/hello_routed_world/src/hello_routed_world.e b/examples/hello_routed_world/src/hello_routed_world.e index 2e0f5d1b..f98ed0dd 100644 --- a/examples/hello_routed_world/src/hello_routed_world.e +++ b/examples/hello_routed_world/src/hello_routed_world.e @@ -64,7 +64,7 @@ feature -- Execution n := 3 h.put_refresh (l_url, 5, 200) res.set_status_code (200) - res.write_string (h.string) + res.write_headers_string (h.string) from create e until diff --git a/library/server/ewsgi/specification/response/ewsgi_response_buffer.e b/library/server/ewsgi/specification/response/ewsgi_response_buffer.e index 3ce7a4b2..9044414a 100644 --- a/library/server/ewsgi/specification/response/ewsgi_response_buffer.e +++ b/library/server/ewsgi/specification/response/ewsgi_response_buffer.e @@ -97,6 +97,16 @@ feature -- Output operation feature -- Header output operation + write_headers_string (a_headers: STRING) + require + status_set: status_is_set + header_not_committed: not header_committed + deferred + ensure + status_set: status_is_set + header_committed: header_committed + end + write_header (a_status_code: INTEGER; a_headers: detachable ARRAY [TUPLE [key: STRING; value: STRING]]) -- Send headers with status `a_status', and headers from `a_headers' require diff --git a/library/server/ewsgi/src/extra/response_as_result/ewsgi_response.e b/library/server/ewsgi/src/extra/response_as_result/ewsgi_response.e index 35aac77e..221a6f26 100644 --- a/library/server/ewsgi/src/extra/response_as_result/ewsgi_response.e +++ b/library/server/ewsgi/src/extra/response_as_result/ewsgi_response.e @@ -31,7 +31,7 @@ feature {EWSGI_RESPONSE_APPLICATION} -- Response status transmit_to (res: EWSGI_RESPONSE_BUFFER) do res.set_status_code (status) - res.write_string (headers) + res.write_headers_string (headers) from read_block res.write_string (last_block) diff --git a/library/server/ewsgi/src/response/ewsgi_response_buffer.e b/library/server/ewsgi/src/response/ewsgi_response_buffer.e index 84a428d3..50835e14 100644 --- a/library/server/ewsgi/src/response/ewsgi_response_buffer.e +++ b/library/server/ewsgi/src/response/ewsgi_response_buffer.e @@ -115,6 +115,18 @@ feature -- Output operation feature -- Header output operation + write_headers_string (a_headers: STRING) + require + status_set: status_is_set + header_not_committed: not header_committed + do + write (a_headers) + header_committed := True + ensure + status_set: status_is_set + header_committed: header_committed + end + write_header (a_status_code: INTEGER; a_headers: detachable ARRAY [TUPLE [key: STRING; value: STRING]]) -- Send headers with status `a_status', and headers from `a_headers' require @@ -138,8 +150,7 @@ feature -- Header output operation i := i + 1 end end - write (h.string) - header_committed := True + write_headers_string (h.string) ensure status_set: status_is_set header_committed: header_committed