### ----------------------------------------------------
### -- Humming-Bird
### -- Licenses: MIT
### -- Authors: Rawley Fowler
### -- File: t/08-static.rakutest
### ----------------------------------------------------
use v6.d;

use Test;

use Humming-Bird::Core;
use Humming-Bird::Glue;
use HTTP::Status;

plan 6;

static('/static', 't/static');

ok routes{'/'}{'static'}, 'Is route OK?';
ok routes{'/'}{'static'}{GET}, 'Is route method OK?';
is routes{'/'}{'static'}{GET}(Request.new(path => 't/static/test.css', method => GET, version => 'HTTP/1.1')).status, HTTP::Status(200), 'Is response status OK?';
is routes{'/'}{'static'}{GET}(Request.new(path => 't/static/test.css', method => GET, version => 'HTTP/1.1')).body.decode.chomp, q<img { color: 'blue'; }>, 'Is response body OK?';
is routes{'/'}{'static'}{GET}(Request.new(path => 't/static/test.css', method => GET, version => 'HTTP/1.1')).header('Content-Type'), 'text/css', 'Is content-type OK?';
is routes{'/'}{'static'}{GET}(Request.new(path => 't/static/test.css.bob', method => GET, version => 'HTTP/1.1')).status, HTTP::Status(404), 'Is missing response status OK?';

done-testing;


