v1.13.0
Install
luarocks install lapis
Additions
- Add the
lapis simulate
command to simulate a request to the application
without starting a server. This is useful for testing and debugging. See
lapis simulate --help
for details about usage. - Add support for SQLite (See
lapis.db.sqlite
,lapis.db.sqlite.model
,
lapis.db.sqlite.schema`) - Add
request:get_request()
method to get a reference to the request object.
(Note this just returnsself
, but it is useful in cases where the request
object is being proxied through the helper chain of a widget)
Changes
- The default error page will now render a JSON response if the
accept
request header is set toapplication/json
content_for
now stores content blocks directly on the request object
(prefixed with_content_for
). This may solve a bug where widget helper
chain could have cached an outdated copy of thecontent_for
state.content_for
will now throw an error if attempted to be used in a context
without a request object- Layout content rendering has been simplified to avoid additional closure and
function scope created - The resolved layout is now written to
request.options
(akaself.options
)
so that the view can know if a layout will be rendered within the current
request. Note: actions that skip layout by default (eg.json
,redirect_to
)
will writefalse
tooptions.layout
. - Internal refactors to all of the database modules, removal of some
undocumented functions (removedset_backend
,set_logger
,get_logger
,init_logger
) - Updated generated SQL for MySQL in some places to output keywords in capitals
lapis.db.pagination
Paginators now have a simple fallback for clause
generation when the database module lacks a clause parser. (Will work for
simple queries without aggregates instead of throwing an error when calling
total_items
andhas_items
)lapis.spec
Remove undocumented test helpers:use_db_connection
,assert_no_queries
.lapis.spec
use_test_env
anduse_test_server
no longer interact with
database connection insetup
andteardown
.lapis.spec.request
The mockedngx
object now covers more fields to make
it suitable for more kinds of requests
Full Changelog: v1.12.0...v1.13.0