Now WGI_RESPONSE.set_status_code (..) has a new argument to pass optional custom reason phrase.
This is a minor breaking change (but prior to the first release, so acceptable) And then it is now possible to precise a custom reason phrase (useful for 4xx and 5xx response) At the WSF_RESPONSE level, the status code is now sent only when the header are sent. thus, it is possible to change the status code as long as no header is sent. (in the future, we should also try to delay the sending of headers) Removed WGI_RESPONSE.put_header_lines (..) which was not used, and WGI is not meant to provide such user friendly features Now this is available directly on WSF_RESPONSE
This commit is contained in:
@@ -54,21 +54,25 @@ feature -- Status setting
|
||||
status_is_set: BOOLEAN
|
||||
-- Is status set?
|
||||
do
|
||||
Result := status_code /= 0
|
||||
Result := status_code > 0
|
||||
end
|
||||
|
||||
set_status_code (a_code: INTEGER)
|
||||
set_status_code (a_code: INTEGER; a_reason_phrase: detachable READABLE_STRING_8)
|
||||
-- Set response status code
|
||||
-- Should be done before sending any data back to the client
|
||||
do
|
||||
status_code := a_code
|
||||
output.put_status_line (a_code)
|
||||
status_reason_phrase := a_reason_phrase
|
||||
output.put_status_line (a_code, a_reason_phrase)
|
||||
status_committed := True
|
||||
end
|
||||
|
||||
status_code: INTEGER
|
||||
-- Response status
|
||||
|
||||
status_reason_phrase: detachable READABLE_STRING_8
|
||||
-- Custom status reason phrase for the Response (optional)
|
||||
|
||||
feature -- Header output operation
|
||||
|
||||
put_header_text (a_text: READABLE_STRING_8)
|
||||
@@ -78,24 +82,6 @@ feature -- Header output operation
|
||||
header_committed := True
|
||||
end
|
||||
|
||||
put_header_lines (a_lines: ITERABLE [TUPLE [name: READABLE_STRING_8; value: READABLE_STRING_8]])
|
||||
local
|
||||
h: STRING_8
|
||||
do
|
||||
create h.make (256)
|
||||
across
|
||||
a_lines as c
|
||||
loop
|
||||
h.append (c.item.name)
|
||||
h.append_character (':')
|
||||
h.append_character (' ')
|
||||
h.append (c.item.value)
|
||||
h.append_character ('%R')
|
||||
h.append_character ('%N')
|
||||
end
|
||||
put_header_text (h)
|
||||
end
|
||||
|
||||
feature -- Output operation
|
||||
|
||||
put_character (c: CHARACTER_8)
|
||||
|
||||
Reference in New Issue
Block a user