Closed drudgesentinel closed 1 year ago
You should be able to add a test to it/01-basic.rakutest
, that just checks to make sure the filename is correct.
Seems like Github actions are broken. I'll test locally for now.
I'm looking at the tests in 01-basic, and I'm not sure how to simulate a filename for a nested piece of response content (e.g. $request.content<file-upload><filename>
)
I'm assuming I'd build a request specifying the filename as structured in Content-Disposition
, conceptually something like:
$req = Request.new(path => '/', method => POST, version => 'HTTP/1.1', 'file-upload['filename']' => 'name="example-filename.bz2"')
is routes{'/'}{POST}($req).content.file-upload('filename'), 'example-filename.bz2', 'Does the filename match expected values?)';
And test against that, but this syntax isn't valid since it looks like (I'm not very raku proficient and I'm basing this on arrow syntax) these are pairs and not actual hashes
@goldendemise If you look at the bottom of it/01-basic.rakutest
there are some file upload tests, you can simply test the filename here. It should be baobao.jpg
. it
tests are integration tests, meaning it spins up an actual humming-bird server and makes calls against it.
Updated to check the filename parses correctly, appreciate your patience/working with me on this.
Let me know if there's anything else I should address in this commit!
it/01-basic.rakutest ............. ok
it/02-error-handlers.rakutest .... ok
it/03-middlewares.rakutest ....... ok
it/04-catch-all-routes.rakutest .. ok
t/01-basic.rakutest .............. ok
t/02-request_encoding.rakutest ... ok
t/03-response_decoding.rakutest .. ok
t/04-middleware.rakutest ......... ok
t/05-cookie.rakutest ............. ok
t/06-redirect.rakutest ........... ok
t/07-advice.rakutest ............. ok
t/08-static.rakutest ............. ok
t/09-routers.rakutest ............ ok
t/10-content-guessing.rakutest ... ok
t/11-advanced-query.rakutest ..... ok
t/12-headers.rakutest ............ ok
All tests successful.
Files=16, Tests=123, 12 wallclock secs
Result: PASS
LGTM
Updated the regex in #69 :sunglasses:
I tried to match CDATA requirements as I understand them:
I don't have thorough tests in place or anything, I experimented with making it a named regex but ran into time consuming unpleasantness/errors
lmk if you need anything further on it