shard-kemal/spec
Imran Latif d25a611fbd Implemented HTTP HEAD method.
First I tried implementing this solution in such a way that it
explicitly clears body and set `Content-Length` header to body's size.
But for some reason, if I call the URL from cURL then `Content-Length`
header was blank which defeats the very purpose of `HEAD` requests.

I then later anticipated that since `HEAD` would be by-default
implemented by `HTTP::Server` module, there is no need to explicit
clears body and setting `Content-Length` but the way we have written
our previous specs were returning body as well. We could have used some
TestServer kind of thing but if we go to that route we explicitly need
to test non-existent route which I thought would create some
inconsistency among specs.

Crystal has clearly written specs for HEAD requests to make sure body
is not read for them. See
https://github.com/manastech/crystal/commit/acd0b6afb5af438a30529c36b11b
e7954336f23f. I decided to write simple specs which are easy to
maintain in long-run.

We are adding identical HEAD route for every GET route which will make
HEAD requests available for all defined GET requests.

https://github.com/sdogruyol/kemal/issues/19

Added comment for code line which is adding HEAD routes for defined GET routes.
2015-12-04 19:35:14 +05:00
..
all_spec.cr Handle POST request, and some refactors 2014-07-30 19:58:48 -03:00
config_spec.cr Updated logger to be more robust 2015-11-18 22:45:49 +02:00
context_spec.cr Refactored context 2015-10-30 22:34:44 +02:00
kemal_handler_spec.cr Implemented HTTP HEAD method. 2015-12-04 19:35:14 +05:00
logger_spec.cr add colorize for logger 2015-11-22 20:06:26 +02:00
param_parser_spec.cr parse request body for array 2015-11-10 13:30:16 +02:00
route_spec.cr Fixed match bug 2015-10-31 09:28:25 +02:00
spec_helper.cr Set to development before_each spec 2015-11-25 23:35:04 +02:00