Ensure expected eyre test results always up-to-date
By dynamically generating the content-length headers for the expected
results, based on their actual content.
%give
%response
%start
+ ::
+ %+ complete-http-start-event
:- 404
- :~ ['content-type' 'text/html']
- ['content-length' '156']
- ==
+ ['content-type' 'text/html']~
[~ (error-page:http-server-gate 404 %.n '/' ~)]
- complete=%.y
== ==
==
::
^= expected-move
:~ :* duct=~[/http-blah] %give %response
%start
+ ::
+ %+ complete-http-start-event
:- 500
- :~ ['content-type' 'text/html']
- ['content-length' '180']
- ==
+ ['content-type' 'text/html']~
[~ (internal-server-error:http-server-gate %.n '/' ~)]
- complete=%.y
== == ==
::
;: weld
==
^= expected-move
:~ :* duct=~[/http-blah] %give %response
- :* %start
+ %start
+ ::
+ %+ complete-http-start-event
:- 200
- :~ ['content-type' 'text/plain']
- ['content-length' '13']
- ==
+ ['content-type' 'text/plain']~
`[13 'one two three']
- %.y
- == == == ==
+ == == ==
::
;: weld
results1
%give
%response
%start
- :- 403
- :~ ['content-type' 'text/html']
- ['content-length' '182']
- ==
::
+ %+ complete-http-start-event
+ :- 403
+ ['content-type' 'text/html']~
:- ~
%- error-page:http-server-gate :*
403
'/~/channel/1234567890abcdef'
~
==
- ::
- complete=%.y
== ==
==
::
%give
%response
%start
+ ::
+ %+ complete-http-start-event
:- 200
- :~ ['content-type' 'text/html']
- ['content-length' '1752']
- ==
+ ['content-type' 'text/html']~
[~ (login-page:http-server-gate `'/~landscape/inner-path' ~nul)]
- complete=%.y
== ==
==
:: a response post redirects back to the application, setting cookie
:: This is the default code for a fakeship.
::
[~ ~ %noun !>(.~lidlut-tabwed-savheb-loslux)]
+:: produce the body of a %start http-event with the correct content-length
+::
+++ complete-http-start-event
+ |= [response-header:http data=(unit octs)]
+ =- [[status-code -] data %.y]
+ ?~ data headers
+ %+ weld headers
+ ['content-length' (crip ((d-co:co 1) p.u.data))]~
--
